1

Drupal doesn't call the theme function for my form in my module (error log: Theme hook wc_challenge_actions not found.). I found similar posts on stack exchange, but none of the solutions works for me.

Form declaration

    function wc_challenge_actions($form, &$form_state, weACT_Challenge $challenge) {
      $form['action_groups']['#tree'] = TRUE;
      $form['action_groups']['#type'] = 'fieldset';
      $form['action_groups']['#title'] = t('Action groups');
      $form['action_groups']['#theme'] = 'wc_challenge_actions';

      // rest of form definition, works correctly

      return $form;
    }

Theme function

    function theme_wc_challenge_actions($variables) {
      drupal_set_message('The theme worked!');

      // rest
    }

Drupal never calls this function... Any ideas?

1 Answer 1

5

You have not defined your theme function in hook_theme

 function yourmodule_theme() {
   return array(
     'wc_challenge_actions' => array (
       'render element' => 'element',
     ),
   );
 }
1
  • In the end, this worked best for me: 'wc_challenge_actions' => array ( 'arguments' => array('form' => NULL), 'render element' => 'form', )
    – Naoki
    Commented Aug 9, 2013 at 13:28

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.