You are here

function theme_messaging_template_admin_templates in Messaging 6.3

Theme settings form

1 theme call to theme_messaging_template_admin_templates()
messaging_template_admin_settings in messaging_template/messaging_template.admin.inc
Template settings: enable/disable, fallback, etc...

File

messaging_template/messaging_template.admin.inc, line 466
Messaging Framework - Admin UI

Code

function theme_messaging_template_admin_templates(&$elements) {
  $output = '';

  // Group them by module
  $groups = array();
  foreach (element_children($elements) as $key) {
    $module = $elements[$key]['module']['#value'];
    $groups[$module][] = array(
      '',
      drupal_render($elements[$key]['enabled']),
      theme('messaging_template_admin_type', $key),
      drupal_render($elements[$key]['fallback']),
    );
  }

  // Now convert groups into a table
  $header = array(
    t('Module'),
    t('Enabled'),
    t('Template'),
    t('Fall back'),
  );
  $rows = array();

  // Get current list of modules.
  $files = module_rebuild_cache();
  foreach ($groups as $module => $templates) {
    $templates[0][0] = $files[$module]->info['name'];

    //, 'rowspan' => count($templates));

    //$row = array_merge($row, array_shift($templates));

    //$rows[] = $row;

    //$templates[0][0] = array('data' => $files[$module]->info['name'], 'rowspan' => count($templates));

    // Add the rest of the templates
    $rows = array_merge($rows, $templates);
  }
  $output .= theme('table', $header, $rows);

  //$output .= drupal_render($elements);
  return $output;
}