function theme_update_advanced_settings in Update Status Advanced Settings 7
Same name and namespace in other branches
- 6 update_advanced.settings.inc \theme_update_advanced_settings()
Theme function for the update status settings tab.
Formats the table of per-project settings, and renders the rest of the form elements into their proper places for maximum clarity.
File
- ./
update_advanced.settings.inc, line 72 - Code only required on the settings tab of the update status page.
Code
function theme_update_advanced_settings($variables) {
$form = $variables['form'];
$output = '';
// Render the core update settings form.
$output .= drupal_render($form['update_check_frequency']);
$output .= drupal_render($form['update_check_disabled']);
$output .= drupal_render($form['update_notify_emails']);
$output .= drupal_render($form['update_notification_threshold']);
$header = array(
array(
'data' => t('Project'),
'class' => array(
'update-advanced-project',
),
),
array(
'data' => t('Warn if out of date'),
'class' => 'update-advanced-status',
),
array(
'data' => t('Notes'),
'class' => array(
'update-advanced-notes',
),
),
);
$data = $form['data']['#value'];
$available = $form['available']['#value'];
$rows = array();
foreach ($data as $key => $project) {
if (isset($available[$key])) {
$row = array();
$row[] = array(
'class' => array(
'update-project',
),
'data' => check_plain(isset($project['title']) ? $project['title'] : $project['info']['name']),
);
$row[] = array(
'class' => array(
'update-status',
),
'data' => drupal_render($form['update_advanced_project_settings'][$key]['check']),
);
$row[] = array(
'class' => array(
'update-notes',
),
'data' => drupal_render($form['update_advanced_project_settings'][$key]['notes']),
);
if (!isset($rows[$project['project_type']])) {
$rows[$project['project_type']] = array();
}
$row_key = drupal_strtolower(isset($project['title']) ? $project['title'] : $project['info']['name']);
$rows[$project['project_type']][$row_key] = $row;
}
}
$split_rows = array();
$project_types = array(
'core' => t('Drupal core'),
'module' => t('Modules'),
'theme' => t('Themes'),
'module-disabled' => t('Disabled modules'),
'theme-disabled' => t('Disabled themes'),
);
foreach ($project_types as $type_name => $type_label) {
if (!empty($rows[$type_name])) {
$split_rows[] = array(
'class' => array(
'update-advanced-settings-label',
),
'data' => array(
array(
'class' => array(
'update-advanced-settings-label',
),
'data' => $type_label,
'colspan' => 3,
),
),
);
ksort($rows[$type_name]);
$split_rows = array_merge($split_rows, $rows[$type_name]);
}
}
$output .= theme('table', array(
'header' => $header,
'rows' => $split_rows,
'attributes' => array(
'class' => array(
'update-advanced-settings',
),
),
));
$output .= '<div class="description">' . "\n";
$output .= drupal_render($form['update_advanced_project_settings_help']);
$output .= "</div>\n";
$output .= drupal_render($form['actions']);
$output .= drupal_render_children($form);
return $output;
}