You are here

function theme_subscriptions_ui_table in Subscriptions 6

Same name and namespace in other branches
  1. 5.2 subscriptions_ui.module \theme_subscriptions_ui_table()
  2. 7 subscriptions_ui.module \theme_subscriptions_ui_table()
  3. 2.0.x subscriptions_ui/subscriptions_ui.module \theme_subscriptions_ui_table()

Theme subscriptions node subform table.

1 theme call to theme_subscriptions_ui_table()
subscriptions_ui_node_form in ./subscriptions_ui.module
Returns the form definition for the node subform.

File

./subscriptions_ui.module, line 269
Provides a user interface for Subscriptions.

Code

function theme_subscriptions_ui_table($element) {
  $rows = array();
  $headers = array();
  $header_strings = array(
    array(
      'class' => 'subscriptions-table',
      'width' => '30%',
    ),
    array(
      'data' => t('On updates'),
      'width' => '1*',
      'style' => 'writing-mode: lr-tb',
    ),
    array(
      'data' => t('On comments'),
    ),
  );
  foreach (element_children($element['subscriptions']) as $key) {
    $row = array();
    foreach (array(
      'subscriptions',
      'updates',
      'comments',
    ) as $eli => $elv) {
      if (isset($element[$elv]) && $element[$elv]['#access']) {
        $row[] = drupal_render($element[$elv][$key]);
        $headers[$eli] = $header_strings[$eli];
      }
    }
    $rows[] = $row;
  }
  $header_keys = array_keys($headers);
  unset($headers[end($header_keys)]['width']);
  $output = theme('table', $headers, $rows);
  $output .= drupal_render($element);
  drupal_add_js(drupal_get_path('module', 'subscriptions') . '/subscriptions_tableselect.js', 'module');
  return $output;
}