I'm working on a module in which I need to theme a form as a table.

I have a function set as email_subscriptions_taxonomy_form($form_state) this will return $form;

The next function below this is theme_email_subscriptions_taxonomy_form($form) this will return $output;

From there return $output; is called by a page callback in the modules

However this error keeps greeting me:

warning: Missing argument 1 for theme_email_subscriptions_taxonomy_form() in /var/www/vhosts/autoallianceissues.com/httpdocs/sites/all/modules/email_subscriptions_taxonomy/email_subscriptions_taxonomy.module on line 112.

As if it is completley ignoring the hook....or else the hook is not implemented properly

Sample code:

/**
 * Returns a form of vocabulary terms
 *
 * @return $form
 */
 function email_subscriptions_taxonomy_form($form_state) {
  global $user;
  
  $vocabularies = email_subscriptions_taxonomy_get_vocabularies();

  $checked = '0';
      
  foreach ($vocabularies as $voc) {
    //$header = array($voc['#name'], 'Subscribe');

    $select_terms = db_query("SELECT DISTINCT d.tid, d.name FROM {term_data} d WHERE d.vid = '%d' AND d.name != 'active' AND d.name != 'inactive' ORDER BY d.tid ASC", $voc['#vid']);
    $form[$voc['#name']] = array (
      '#type' => 'fieldset', 
      '#title' => $voc['#name'], 
    );  
    while ($return_terms = db_fetch_object($select_terms)) {
      $form[$voc['#name']]['subscription_' . $return_terms->tid]['name'] = array (
        '#name' => 'subscription_' . $return_terms->tid,
        '#id' => 'subscription_' . $return_terms->tid,
        '#title' => $return_terms->name,
      );  
      $form[$voc['#name']]['subscription_' . $return_terms->tid]['checkbox'] = array (
        '#type' => 'checkbox',
        '#name' => 'subscription_' . $return_terms->tid,
        '#id' => 'subscription_' . $return_terms->tid,
        '#default_value' => '0',
      );  
    }
    $form[$voc['#name']]['header'] = array(
      '#type' => 'value', 
      '#value' => array( 
        array($voc['#name']), 
        array('data' => t('Subscribe')),
      )
    );
  }
  
  $form['submit'] = array('#type' => 'submit', '#name' => 'submit', '#value' => t('Save'));

  return $form;
 }
 
 
 
/**
 * Themes the form as a table
 *
 * @return $form
 */
 function theme_email_subscriptions_taxonomy_form($form) {
 
  $vocabularies = email_subscriptions_taxonomy_get_vocabularies();

  foreach ($vocabularies as $voc) {
    drupal_render($form[$voc['#name']]);
    
    $select_terms = db_query("SELECT DISTINCT d.tid, d.name FROM {term_data} d WHERE d.vid = '%d' AND d.name != 'active' AND d.name != 'inactive' ORDER BY d.tid ASC", $voc['#vid']);
    while ($return_terms = db_fetch_object($select_terms)) {
      $rows[] = array($return_terms->name, drupal_render($form[$voc['#name']]['subscription_' . $return_terms->tid]['checkbox']));
    }
    $header = drupal_render($form[$voc['#name']]['header']['#value']);
    $output .= theme('table', $header, $rows) . drupal_render($form['submit']);
    $rows = '';
  }
  return $output;
 }

Comments

drupal_user_1844’s picture

Did you ever figure this out? I'm trying to render a form as a table.