You are here

public function WizardPluginBase::getFilters in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php \Drupal\views\Plugin\views\wizard\WizardPluginBase::getFilters()
  2. 9 core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php \Drupal\views\Plugin\views\wizard\WizardPluginBase::getFilters()

Gets the filters property.

Return value

array

2 calls to WizardPluginBase::getFilters()
BlockContent::getFilters in core/modules/block_content/src/Plugin/views/wizard/BlockContent.php
Gets the filters property.
WizardPluginBase::defaultDisplayFilters in core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
Retrieves all filter information used by the default display.
1 method overrides WizardPluginBase::getFilters()
BlockContent::getFilters in core/modules/block_content/src/Plugin/views/wizard/BlockContent.php
Gets the filters property.

File

core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php, line 175

Class

WizardPluginBase
Base class for Views wizard plugins.

Namespace

Drupal\views\Plugin\views\wizard

Code

public function getFilters() {
  $filters = [];

  // Add a default filter on the publishing status field, if available.
  if ($this->entityType && is_subclass_of($this->entityType
    ->getClass(), EntityPublishedInterface::class)) {
    $field_name = $this->entityType
      ->getKey('published');
    $this->filters = [
      $field_name => [
        'value' => TRUE,
        'table' => $this->base_table,
        'field' => $field_name,
        'plugin_id' => 'boolean',
        'entity_type' => $this->entityTypeId,
        'entity_field' => $field_name,
      ],
    ] + $this->filters;
  }
  $default = $this->filter_defaults;
  foreach ($this->filters as $name => $info) {
    $default['id'] = $name;
    $filters[$name] = $info + $default;
  }
  return $filters;
}