protected function Node::build_form_style

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').

Overrides WizardPluginBase::build_form_style

File

drupal/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php, line 97
Definition of Drupal\node\Plugin\views\wizard\Node.

Class

Node
Tests creating node views with the wizard.

Namespace

Drupal\node\Plugin\views\wizard

Code

protected function build_form_style(array &$form, array &$form_state, $type) {
  parent::build_form_style($form, $form_state, $type);
  $style_form =& $form['displays'][$type]['options']['style'];

  // Some style plugins don't support row plugins so stop here if that's the
  // case.
  if (!isset($style_form['row_plugin']['#default_value'])) {
    return;
  }
  $row_plugin = $style_form['row_plugin']['#default_value'];
  switch ($row_plugin) {
    case 'full_posts':
    case 'teasers':
      $style_form['row_options']['links'] = array(
        '#type' => 'select',
        '#title_display' => 'invisible',
        '#title' => t('Should links be displayed below each node'),
        '#options' => array(
          1 => t('with links (allow users to add comments, etc.)'),
          0 => t('without links'),
        ),
        '#default_value' => 1,
      );
      $style_form['row_options']['comments'] = array(
        '#type' => 'select',
        '#title_display' => 'invisible',
        '#title' => t('Should comments be displayed below each node'),
        '#options' => array(
          1 => t('with comments'),
          0 => t('without comments'),
        ),
        '#default_value' => 0,
      );
      break;
  }
}