function theme_system_modules_details

Returns HTML for the modules form.

Parameters

$variables: An associative array containing:

  • form: A render element representing the form.

Related topics

1 theme call to theme_system_modules_details()
system_modules in drupal/core/modules/system/system.admin.inc
Menu callback; provides module enable/disable interface.

File

drupal/core/modules/system/system.admin.inc, line 2316
Admin page callbacks for the system module.

Code

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

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

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

    // Stick the key into $module for easier access.
    $module = $form[$key];

    // Create the row for the table.
    $row = array();

    // Add the checkbox into the first cell.
    unset($module['enable']['#title']);
    $module['#requires'] = array_filter($module['#requires']);
    $module['#required_by'] = array_filter($module['#required_by']);
    $requires = !empty($module['#requires']);
    $required_by = !empty($module['#required_by']);
    $version = !empty($module['version']['#markup']);
    $row[] = array(
      'class' => array(
        'checkbox',
      ),
      'data' => drupal_render($module['enable']),
    );

    // Add the module label and expand/collapse functionalty.
    $col2 = '<label for="' . $module['enable']['#id'] . '" class="module-name">' . drupal_render($module['name']) . '</label>';
    $row[] = array(
      'class' => array(
        'module',
      ),
      'data' => $col2,
    );

    // Add the description, along with any modules it requires.
    $description = '<span class="details"><span class="text">' . drupal_render($module['description']) . '</span></span>';
    if ($version || $requires || $required_by) {
      $description .= ' <div class="requirements">';
      if ($version) {
        $description .= '<div class="admin-requirements">' . t('Version: !module-version', array(
          '!module-version' => drupal_render($module['version']),
        )) . '</div>';
      }
      if ($requires) {
        $description .= '<div class="admin-requirements">' . t('Requires: !module-list', array(
          '!module-list' => implode(', ', $module['#requires']),
        )) . '</div>';
      }
      if ($required_by) {
        $description .= '<div class="admin-requirements">' . t('Required by: !module-list', array(
          '!module-list' => implode(', ', $module['#required_by']),
        )) . '</div>';
      }
      $description .= '</div>';
    }
    $links = '';
    foreach (array(
      'help',
      'permissions',
      'configure',
    ) as $key) {
      $links .= drupal_render($module['links'][$key]);
    }
    if ($links) {
      $description .= '  <div class="links">';
      $description .= $links;
      $description .= '</div>';
    }
    $col4 = '<div class="inner" tabindex="0" role="button"><span class="module-description-prefix element-invisible">Show description</span> ' . $description . '</div>';
    $row[] = array(
      'class' => array(
        'description',
        'expand',
      ),
      'data' => $col4,
    );
    $rows[] = $row;
  }
  return theme('table', array(
    'header' => $form['#header'],
    'rows' => $rows,
  ));
}