You are here

function space_customizer_views::form in Spaces 5.2

Same name and namespace in other branches
  1. 6 spaces.module \space_customizer_views::form()

Overrides space_customizer::form

File

./spaces.module, line 493

Class

space_customizer_views
Customizer for views titles and headers.

Code

function form($space, $feature) {
  $features = spaces_features();
  $f = $features[$feature];
  $form = array();
  foreach ($f->views as $view_name) {
    $view = views_get_view($view_name);
    $view = $this
      ->customize($space, $feature, $view);

    // Only allow customization of page views for now
    // @TODO: add input format checking on headers/footers/etc.
    if ($view && $view->page == TRUE) {
      $form[$view_name] = array(
        '#title' => $view_name,
        '#type' => 'fieldset',
        '#tree' => TRUE,
      );

      // $default_page_title = isset($customizer['views'][$view_name]['page_title']) ? $customizer['views'][$view_name]['page_title'] : $view->page_title;
      $form[$view_name]['page_title'] = array(
        '#title' => t('Page title'),
        '#type' => 'textfield',
        '#size' => 40,
        '#default_value' => $view->page_title,
      );

      // $default_page_header = isset($customizer['views'][$view_name]['page_header']) ? $customizer['views'][$view_name]['page_header'] : $view->page_header;
      $form[$view_name]['page_header'] = array(
        '#title' => t('Page header'),
        '#type' => 'textarea',
        '#rows' => 2,
        '#cols' => 40,
        '#default_value' => $view->page_header,
      );
    }
  }
  return $form;
}