0

I have built hook_themes many times and never encountered this before but I am getting the following errors:

Warning: Missing argument 1 for geocoder_custom_theme Warning: Missing argument 2 for geocoder_custom_theme Warning: Missing argument 3 for geocoder_custom_theme Warning: Missing argument 4 for geocoder_custom_theme Warning: Illegal offset type in isset or empty in drupal_theme_access() line 53

I have tried clearing cache, renaming the hook, registry rebuild and nothing works. I have another hook_theme in a different custom module that is basically the same thing but works completely fine. Also if i simply return an empty array() it still does it. Its like drupal doesn't send any values to my hook for whatever reason.

Code:

function geocoder_custom_theme($existing, $type, $theme, $path)
{
  return array(
    'geocoder_custom_before_me' => array(
      'variables' => array('string' => array()),
      'template' => 'geocoder-before',
      'path' => drupal_get_path('module', 'geocoder_custom') . '/theme'
    ),
    'geocoder_custom_after_me' => array(
      'variables' => array('string' => array()),
      'template' => 'geocoder-after',
      'path' => drupal_get_path('module', 'geocoder_custom') . '/theme'
    )
  );
}

1 Answer 1

3

That function is taken from Drupal as an implementation of hook_custom_theme(), not hook_theme(). Since the former doesn't get any arguments, PHP is complaining about the function declaring arguments for which it doesn't get any value.

The fix is changing the short name of the module from geocoder_custom to geocoder, for example.

1
  • Makes sense and I didn't even know that hook existed. I should avoid using _custom on future custom module implementations. Apr 22, 2014 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.