You are here

function theme_module_filter_modules_table in Module Filter 7

@file

@author greenSkin

1 theme call to theme_module_filter_modules_table()
module_filter_form_system_modules_alter in ./module_filter.module
Implementation of hook_form_FORM_ID_alter().

File

./module_filter.theme.inc, line 9
@author greenSkin

Code

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

  // Individual table headers.
  $rows = array();

  // Iterate through all the modules, which are
  // children of this fieldset.
  foreach (element_children($form) as $key) {

    // Stick it into $module for easier accessing.
    $module = $form[$key];
    $row = array();
    unset($module['enable']['#title']);
    $row[] = array(
      'class' => array(
        'checkbox',
      ),
      'data' => drupal_render($module['enable']),
    );
    $label = '<label';
    if (isset($module['enable']['#id'])) {
      $label .= ' for="' . $module['enable']['#id'] . '"';
    }
    $row[] = $label . '><strong>' . drupal_render($module['name']) . '</strong><br><span class="module-machine-name">(' . $key . ')</span></label>';
    $row[] = drupal_render($module['version']);

    // Add the description, along with any modules it requires.
    $description = drupal_render($module['description']);
    if ($module['#requires']) {
      $description .= '<div class="admin-requirements">' . t('Requires: !module-list', array(
        '!module-list' => implode(', ', $module['#requires']),
      )) . '</div>';
    }
    if ($module['#required_by']) {
      $description .= '<div class="admin-requirements">' . t('Required by: !module-list', array(
        '!module-list' => implode(', ', $module['#required_by']),
      )) . '</div>';
    }
    $row[] = array(
      'data' => $description,
      'class' => array(
        'description',
      ),
    );

    // Display links (such as help or permissions) in their own columns.
    foreach (array(
      'help',
      'permissions',
      'configure',
    ) as $key) {
      $row[] = array(
        'data' => drupal_render($module['links'][$key]),
        'class' => array(
          $key,
        ),
      );
    }
    $id = module_filter_get_id($module['#package']);
    $rows[] = array(
      'data' => $row,
      'class' => array(
        $id . '-tab-content',
      ),
    );
  }
  return theme('table', array(
    'header' => $form['#header'],
    'rows' => $rows,
    'attributes' => array(
      'class' => array(
        'package',
      ),
    ),
  ));
}