You are here

protected function Comment::build_form_style in Views (for Drupal 7) 8.3

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

lib/Views/comment/Plugin/views/wizard/Comment.php, line 77
Definition of Views\node\Plugin\views\wizard\Comment.

Class

Comment
Tests creating comment views with the wizard.

Namespace

Views\comment\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 'comment':
      $style_form['row_options']['links'] = array(
        '#type' => 'select',
        '#title_display' => 'invisible',
        '#title' => t('Should links be displayed below each comment'),
        '#options' => array(
          1 => t('with links (allow users to reply to the comment, etc.)'),
          0 => t('without links'),
        ),
        '#default_value' => 1,
      );
      break;
  }
}