function theme_features_form_package in Features 6
Same name and namespace in other branches
- 7.2 theme/theme.inc \theme_features_form_package()
- 7 theme/theme.inc \theme_features_form_package()
Theme for features management form.
1 theme call to theme_features_form_package()
- features_admin_form in ./
features.admin.inc - admin/build/features page callback.
File
- theme/
theme.inc, line 184
Code
function theme_features_form_package($form) {
drupal_add_css(drupal_get_path('module', 'features') . '/features.css');
drupal_add_js(drupal_get_path('module', 'features') . '/features.js');
$output = '';
$header = array(
'',
t('Feature'),
t('Signature'),
);
if (isset($form['state'])) {
$header[] = t('State');
}
if (isset($form['actions'])) {
$header[] = t('Actions');
}
$rows = array();
foreach (element_children($form['status']) as $element) {
// Yank title & description fields off the form element for
// rendering in their own cells.
$name = "<div class='feature'>";
$name .= "<strong>{$form['status'][$element]['#title']}</strong>";
$name .= "<div class='description'>{$form['status'][$element]['#description']}</div>";
$name .= "</div>";
unset($form['status'][$element]['#title']);
unset($form['status'][$element]['#description']);
// Determine row & cell classes
$class = $form['status'][$element]['#default_value'] ? 'enabled' : 'disabled';
$row = array(
'status' => array(
'data' => drupal_render($form['status'][$element]),
'class' => 'status',
),
'name' => array(
'data' => $name,
'class' => 'name',
),
'sign' => array(
'data' => drupal_render($form['sign'][$element]),
'class' => 'sign',
),
);
if (isset($form['state'])) {
$row['state'] = array(
'data' => drupal_render($form['state'][$element]),
'class' => 'state',
);
}
if (isset($form['actions'])) {
$row['actions'] = array(
'data' => drupal_render($form['actions'][$element]),
'class' => 'actions',
);
}
$rows[] = array(
'data' => $row,
'class' => $class,
);
}
if (empty($rows)) {
$rows[] = array(
'',
array(
'data' => t('No features available.'),
'colspan' => count($header),
),
);
}
$class = count($header) > 3 ? 'features features-admin' : 'features features-manage';
$output .= theme('table', $header, $rows, array(
'id' => 'features-form-table',
'class' => $class,
));
// Prevent section from being rendered by drupal_render().
unset($form['features']);
$output .= drupal_render($form['buttons']);
$output .= drupal_render($form);
return $output;
}