You are here

function theme_spaces_features_form in Spaces 5

Same name and namespace in other branches
  1. 5.2 spaces_admin.inc \theme_spaces_features_form()
  2. 6.3 spaces.theme.inc \theme_spaces_features_form()
  3. 6 spaces_admin.inc \theme_spaces_features_form()
  4. 6.2 spaces.theme.inc \theme_spaces_features_form()

Theme for spaces featuers/settings form.

File

./spaces_admin.inc, line 151

Code

function theme_spaces_features_form($form) {
  drupal_add_css(drupal_get_path('module', 'spaces') . '/spaces.css');
  $output = '';
  foreach (array(
    'features',
    'settings',
  ) as $type) {
    $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>";
      unset($form[$type][$element]['#title']);
      unset($form[$type][$element]['#description']);
      $rows[] = array(
        'data' => array(
          $feature_name,
          drupal_render($form[$type][$element]),
          $description,
        ),
        'class' => $form[$type][$element]['#default_value'] ? 'enabled' : 'disabled',
      );
    }
    $output .= "<h3>" . $form[$type]['#title'] . "</h3>";
    $output .= "<div class='description'>" . $form[$type]['#description'] . "</div>";
    unset($form[$type]);
    $output .= theme('table', array(), $rows, array(
      'class' => 'spaces-' . $type,
    ));
  }
  $output .= "<div class='buttons'>" . drupal_render($form['submit']) . "</div>";
  $output .= drupal_render($form);
  return $output;
}