[development] Error defining parameters in hook_theme

Steve Edwards killshot91 at comcast.net
Mon Dec 7 21:06:20 UTC 2009


In a module I'm creating, I'm embedding the subqueue edit form from the 
Nodequeue module, and I need to replace the title with a text field and 
use a custom theme function (overriding theme_form_element) for the 
textfield.  I've registered my theme function with hook_theme:

/**
 * Implementation of hook_theme
 */
function mymodule_theme() {
  return array(
    'mymodule_subqueue_title' => array(
      'arguments' => array($element => NULL, $value => NULL),
    ),
  );
}

And then call it in my hook_form_alter"

        $form[$item->nid]['item_title'] = array(
          '#default_value' => $item->title,
          '#type' => 'textfield',
          '#size' => 10,
          '#maxlength' => 50,
          '#theme' => 'mymodule_subqueue_title',
        );


and define my function:

function theme_mymodule_subqueue_title($element, $value) {

The problem I'm getting is this error message:

Missing argument 2 for theme_mymodule_subqueue_title() in 
.../sites/all/modules/custom/feature_package/mymodule.module on line 450.

I'm guessing the problem is in how I define my arguments in hook_theme.  
Is that what I'm doing wrong, or is it something else?

Thanks,

Steve


More information about the development mailing list