function theme_features_form_package in Features 7.2
Same name and namespace in other branches
- 6 theme/theme.inc \theme_features_form_package()
- 7 theme/theme.inc \theme_features_form_package()
Theme for features management form.
Parameters
array $vars: Variables for this theme hook.
Return value
string Rendered HTML.
Throws
\Exception Exceptions can be thrown in theme(), if called pre-boot.
1 theme call to theme_features_form_package()
- features_admin_form in ./
features.admin.inc - Form builder for 'admin/structure/features'.
File
- theme/
theme.inc, line 242 - Theme functions and (pre)processors for 'features' module.
Code
function theme_features_form_package(&$vars) {
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($vars['form']['state'])) {
$header[] = t('State');
}
if (isset($vars['form']['actions'])) {
$header[] = t('Actions');
}
$rows = array();
foreach (element_children($vars['form']['status']) as $element) {
// Yank title & description fields off the form element for
// rendering in their own cells.
$name = "<div class='feature'>";
$name .= "<strong>{$vars['form']['status'][$element]['#title']}</strong>";
$name .= "<div class='description'>{$vars['form']['status'][$element]['#description']}</div>";
$name .= "</div>";
unset($vars['form']['status'][$element]['#title']);
unset($vars['form']['status'][$element]['#description']);
// Determine row & cell classes.
$class = $vars['form']['status'][$element]['#default_value'] ? 'enabled' : 'disabled';
$row = array();
$row['status'] = array(
'data' => drupal_render($vars['form']['status'][$element]),
'class' => array(
'status',
),
);
$row['name'] = array(
'data' => $name,
'class' => 'name',
);
$row['sign'] = array(
'data' => drupal_render($vars['form']['sign'][$element]),
'class' => array(
'sign',
),
);
if (isset($vars['form']['state'])) {
$row['state'] = array(
'data' => drupal_render($vars['form']['state'][$element]),
'class' => array(
'state',
),
);
}
if (isset($vars['form']['actions'])) {
$row['actions'] = array(
'data' => drupal_render($vars['form']['actions'][$element]),
'class' => array(
'actions',
),
);
}
$rows[] = array(
'data' => $row,
'class' => array(
$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', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'features-form-table',
'class' => array(
$class,
),
),
));
// Prevent section from being rendered by drupal_render().
$output .= drupal_render($vars['form']['buttons']);
$output .= drupal_render_children($vars['form']);
return $output;
}