You are here

function spaces_view_headers in Spaces 5

View header customization form - ALPHA

Allows group administrators to set a node to be used as the header text for a view in a specific group.

TODO

  • We need a much better UI
  • The data shoudn't all be stored in the variables table.
1 string reference to 'spaces_view_headers'
spaces_menu in ./spaces.module

File

./spaces_admin.inc, line 329

Code

function spaces_view_headers() {
  $nid = arg(1);
  $spaces_features = spaces_features();
  $active_features = spaces_features($nid);
  if (count($active_features)) {
    $form = array();
    $form[] = array(
      '#value' => t('<p>For each view you can select a node to display as the intro text to the listing.</p>'),
    );
    foreach ($active_features as $feature => $active) {
      if ($active && count($spaces_features[$feature]->views)) {
        $form[$feature] = array(
          '#type' => 'fieldset',
          '#title' => $spaces_features[$feature]->spaces['label'],
          '#collapsible' => true,
        );
        foreach ($spaces_features[$feature]->views as $view) {
          $form[$feature]["spaces_header_" . $view . "_" . $nid] = array(
            '#title' => t($view . ' header'),
            '#type' => 'textfield',
            '#maxlength' => 10,
            '#default_value' => variable_get("spaces_header_" . $view . "_" . $nid, ''),
          );
        }
      }
    }
  }
  return system_settings_form($form);
}