You are here

function views_ui_config_style_form in Views (for Drupal 7) 8.3

Same name and namespace in other branches
  1. 6.3 includes/admin.inc \views_ui_config_style_form()
  2. 6.2 includes/admin.inc \views_ui_config_style_form()
  3. 7.3 includes/admin.inc \views_ui_config_style_form()

Form to config_style items in the views UI.

1 string reference to 'views_ui_config_style_form'
views_ui_ajax_forms in views_ui/admin.inc
Returns information about subforms for editing the pieces of a view.

File

views_ui/admin.inc, line 2118
Provides the Views' administrative interface.

Code

function views_ui_config_style_form($form, &$form_state) {
  $view =& $form_state['view'];
  $display_id = $form_state['display_id'];
  $type = $form_state['type'];
  $id = $form_state['id'];
  $form = array(
    'options' => array(
      '#tree' => TRUE,
      '#theme_wrappers' => array(
        'container',
      ),
      '#attributes' => array(
        'class' => array(
          'scroll',
        ),
      ),
    ),
  );
  if (!$view
    ->setDisplay($display_id)) {
    views_ajax_error(t('Invalid display id @display', array(
      '@display' => $display_id,
    )));
  }
  $item = $view
    ->getItem($display_id, $type, $id);
  if ($item) {
    $handler = views_get_handler($item['table'], $item['field'], $type);
    if (empty($handler)) {
      $form['markup'] = array(
        '#markup' => t("Error: handler for @table > @field doesn't exist!", array(
          '@table' => $item['table'],
          '@field' => $item['field'],
        )),
      );
    }
    else {
      $handler
        ->init($view, $item);
      $types = ViewUI::viewsHandlerTypes();
      $form['#title'] = t('Configure summary style for @type %item', array(
        '@type' => $types[$type]['lstitle'],
        '%item' => $handler
          ->adminLabel(),
      ));
      $form['#section'] = $display_id . '-' . $type . '-style-options';
      $plugin = views_get_plugin('style', $handler->options['style']['type']);
      if ($plugin) {
        $form['style_options'] = array(
          '#tree' => TRUE,
        );
        $plugin
          ->init($view, $view->display[$display_id], $handler->options['style']['options']);
        $plugin
          ->buildOptionsForm($form['style_options'], $form_state);
      }
      $form_state['handler'] =& $handler;
    }
    $view
      ->getStandardButtons($form, $form_state, 'views_ui_config_style_form');
  }
  return $form;
}