protected function WizardPluginBase::buildFormStyle

Adds the style options to the wizard form.

Parameters

array $form: The full wizard form array.

array $form_state: The current state of the wizard form.

string $type: The display ID (e.g. 'page' or 'block').

3 calls to WizardPluginBase::buildFormStyle()
Comment::buildFormStyle in drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/wizard/Comment.php
Adds the style options to the wizard form.
Node::buildFormStyle in drupal/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php
Adds the style options to the wizard form.
WizardPluginBase::buildForm in drupal/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php
Drupal\views\Plugin\views\wizard\WizardInterface::buildForm().
2 methods override WizardPluginBase::buildFormStyle()
Comment::buildFormStyle in drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/wizard/Comment.php
Adds the style options to the wizard form.
Node::buildFormStyle in drupal/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php
Adds the style options to the wizard form.

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php, line 508
Definition of Drupal\views\Plugin\views\wizard\WizardPluginBase.

Class

WizardPluginBase
Provides the interface and base class for Views Wizard plugins.

Namespace

Drupal\views\Plugin\views\wizard

Code

protected function buildFormStyle(array &$form, array &$form_state, $type) {
  $style_form =& $form['displays'][$type]['options']['style'];
  $style = $style_form['style_plugin']['#default_value'];
  $style_plugin = Views::pluginManager('style')
    ->createInstance($style);
  if (isset($style_plugin) && $style_plugin
    ->usesRowPlugin()) {
    $options = $this
      ->rowStyleOptions();
    $style_form['row_plugin'] = array(
      '#type' => 'select',
      '#title' => t('of'),
      '#options' => $options,
      '#access' => count($options) > 1,
    );

    // For the block display, the default value should be "titles (linked)",
    // if it's available (since that's the most common use case).
    $block_with_linked_titles_available = $type == 'block' && isset($options['titles_linked']);
    $default_value = $block_with_linked_titles_available ? 'titles_linked' : key($options);
    $style_form['row_plugin']['#default_value'] = static::getSelected($form_state, array(
      $type,
      'style',
      'row_plugin',
    ), $default_value, $style_form['row_plugin']);

    // Changing this dropdown updates the individual row options via AJAX.
    views_ui_add_ajax_trigger($style_form, 'row_plugin', array(
      'displays',
      $type,
      'options',
      'style',
      'row_options',
    ));

    // This is the region that can be updated by AJAX. The base class doesn't
    // add anything here, but child classes can.
    $style_form['row_options'] = array(
      '#theme_wrappers' => array(
        'container',
      ),
    );
  }
  elseif ($style_plugin
    ->usesFields()) {
    $style_form['row_plugin'] = array(
      '#markup' => '<span>' . t('of fields') . '</span>',
    );
  }
}