protected function Node::defaultDisplayFiltersUser

Overrides Drupal\views\Plugin\views\wizard\WizardPluginBase::defaultDisplayFiltersUser().

Overrides WizardPluginBase::defaultDisplayFiltersUser

File

drupal/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php, line 170
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 defaultDisplayFiltersUser(array $form, array &$form_state) {
  $filters = parent::defaultDisplayFiltersUser($form, $form_state);
  if (!empty($form_state['values']['show']['tagged_with']['tids'])) {
    $filters['tid'] = array(
      'id' => 'tid',
      'table' => 'taxonomy_index',
      'field' => 'tid',
      'value' => $form_state['values']['show']['tagged_with']['tids'],
      'vocabulary' => $form_state['values']['show']['tagged_with']['vocabulary'],
    );

    // If the user entered more than one valid term in the autocomplete
    // field, they probably intended both of them to be applied.
    if (count($form_state['values']['show']['tagged_with']['tids']) > 1) {
      $filters['tid']['operator'] = 'and';

      // Sort the terms so the filter will be displayed as it normally would
      // on the edit screen.
      sort($filters['tid']['value']);
    }
  }
  return $filters;
}