function theme_spaces_features_form in Spaces 5.2
Same name and namespace in other branches
- 5 spaces_admin.inc \theme_spaces_features_form()
- 6.3 spaces.theme.inc \theme_spaces_features_form()
- 6 spaces_admin.inc \theme_spaces_features_form()
- 6.2 spaces.theme.inc \theme_spaces_features_form()
Theme for spaces featuers/settings form.
File
- ./
spaces_admin.inc, line 643
Code
function theme_spaces_features_form($form) {
drupal_add_css(drupal_get_path('module', 'spaces') . '/spaces.css');
$output = '';
foreach (array(
'features',
'settings',
) as $type) {
$header = array(
$type == 'features' ? t('Feature') : t('Setting'),
t('Status'),
t('Description'),
!isset($form['space']['#value']->sid) ? t('Locked') : '',
);
$rows = array();
foreach (element_children($form[$type]) as $element) {
$feature_name = "<strong>" . $form[$type][$element]['#title'] . "</strong>";
$description = "<div class='description'>" . $form[$type][$element]['#description'] . "</div>";
$customize = isset($form['customize'][$element]) ? drupal_render($form['customize'][$element]) : '';
$locked = isset($form['locked']) ? drupal_render($form['locked'][$type][$element]) : '';
unset($form[$type][$element]['#title']);
unset($form[$type][$element]['#description']);
$row = array(
'name' => $feature_name,
'option' => drupal_render($form[$type][$element]),
'description' => $description,
'action' => $customize . $locked,
);
foreach ($row as $key => $data) {
$row[$key] = array(
'data' => $data,
'class' => $key,
);
}
$class = $form[$type][$element]['#default_value'] ? 'enabled' : 'disabled';
$class .= $form[$type][$element]['#locked'] ? ' locked' : '';
$rows[] = array(
'data' => $row,
'class' => $class,
);
}
$output .= "<h3>" . $form[$type]['#title'] . "</h3>";
$output .= "<div class='description'>" . $form[$type]['#description'] . "</div>";
$output .= theme('table', $header, $rows, array(
'class' => 'spaces-' . $type,
));
// Prevent section from being rendered by drupal_render().
unset($form[$type]);
}
if (isset($form['submit']) && $form['submit']['#type'] == 'submit') {
$output .= "<div class='buttons'>";
$output .= drupal_render($form['submit']);
$output .= "</div>";
}
$output .= drupal_render($form);
return $output;
}