function _system_modules_build_row
7.x system.admin.inc | _system_modules_build_row($info, $extra) |
Build a table row for the system modules page.
1 call to _system_modules_build_row()
- system_modules in drupal-7.x/
modules/ system/ system.admin.inc - Menu callback; provides module enable/disable interface.
File
- drupal-7.x/
modules/ system/ system.admin.inc, line 968 - Admin page callbacks for the system module.
Code
function _system_modules_build_row($info, $extra) {
// Add in the defaults.
$extra += array(
'requires' => array(),
'required_by' => array(),
'disabled' => FALSE,
'enabled' => FALSE,
'links' => array(),
);
$form = array(
'#tree' => TRUE,
);
// Set the basic properties.
$form['name'] = array(
'#markup' => $info['name'],
);
$form['description'] = array(
'#markup' => t($info['description']),
);
$form['version'] = array(
'#markup' => $info['version'],
);
$form['#requires'] = $extra['requires'];
$form['#required_by'] = $extra['required_by'];
// Check the compatibilities.
$compatible = TRUE;
$status_short = '';
$status_long = '';
// Check the core compatibility.
if (!isset($info['core']) || $info['core'] != DRUPAL_CORE_COMPATIBILITY) {
$compatible = FALSE;
$status_short .= t('Incompatible with this version of Drupal core.');
$status_long .= t('This version is not compatible with Drupal !core_version and should be replaced.', array('!core_version' => DRUPAL_CORE_COMPATIBILITY));
}
// Ensure this module is compatible with the currently installed version of PHP.
if (version_compare(phpversion(), $info['php']) < 0) {
$compatible = FALSE;
$status_short .= t('Incompatible with this version of PHP');
$php_required = $info['php'];
if (substr_count($info['php'], '.') < 2) {
$php_required .= '.*';
}
$status_long .= t('This module requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $php_required, '!php_version' => phpversion()));
}
// If this module is compatible, present a checkbox indicating
// this module may be installed. Otherwise, show a big red X.
if ($compatible) {
$form['enable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable'),
'#default_value' => $extra['enabled'],
);
if ($extra['disabled']) {
$form['enable']['#disabled'] = TRUE;
}
}
else {
$form['enable'] = array(
'#markup' => theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => $status_short, 'title' => $status_short)),
);
$form['description']['#markup'] .= theme('system_modules_incompatible', array('message' => $status_long));
}
// Build operation links.
foreach (array('help', 'permissions', 'configure') as $key) {
$form['links'][$key] = (isset($extra['links'][$key]) ? $extra['links'][$key] : array());
}
return $form;
}