You are here

function theme_makemeeting_choices in Make Meeting Scheduler 7.2

Returns HTML for an admin poll form for choices.

1 theme call to theme_makemeeting_choices()
makemeeting_field_widget_form in ./makemeeting.field.inc
Implements hook_field_widget_form().

File

./makemeeting.theme.inc, line 6

Code

function theme_makemeeting_choices($variables) {
  $form = $variables['form'];

  // Add appropriate CSS.
  drupal_add_css(drupal_get_path('module', 'makemeeting') . '/makemeeting.css');
  $rows = array();
  $headers = array(
    t('Date'),
  );
  $headers_added = FALSE;
  foreach (element_children($form) as $key) {

    // Build the table rows.
    $row = array();
    $row[] = array(
      'data' => drupal_render($form[$key]['chdate']) . drupal_render($form[$key]['chremove']),
      'class' => 'makemeeting-choice-date',
    );
    $delta = 0;
    foreach (element_children($form[$key]['chsuggestions']) as $key2) {
      $delta++;

      // Add sugesstion headers for the first line
      if (!$headers_added) {
        $headers[] = t('Suggestion %num', array(
          '%num' => $delta,
        ));
      }
      $row[] = drupal_render($form[$key]['chsuggestions'][$key2]);
    }
    $headers_added = TRUE;
    $rows[] = $row;
  }
  $output = theme('table', array(
    'header' => $headers,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'poll-choice-table',
    ),
  ));
  $output .= drupal_render_children($form);
  return $output;
}