function Bundle::getValueOptions

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/filter/Bundle.php \Drupal\views\Plugin\views\filter\Bundle::getValueOptions()
  2. 10 core/modules/views/src/Plugin/views/filter/Bundle.php \Drupal\views\Plugin\views\filter\Bundle::getValueOptions()
  3. 11.x core/modules/views/src/Plugin/views/filter/Bundle.php \Drupal\views\Plugin\views\filter\Bundle::getValueOptions()

Overrides InOperator::getValueOptions

File

core/modules/views/src/Plugin/views/filter/Bundle.php, line 103

Class

Bundle
Filter class which allows filtering by entity bundles.

Namespace

Drupal\views\Plugin\views\filter

Code

public function getValueOptions() {
    if (!isset($this->valueOptions)) {
        $types = $this->bundleInfoService
            ->getBundleInfo($this->entityTypeId);
        $this->valueTitle = $this->t('@entity types', [
            '@entity' => $this->entityType
                ->getLabel(),
        ]);
        $options = [];
        foreach ($types as $type => $info) {
            $options[$type] = $info['label'];
        }
        asort($options);
        $this->valueOptions = $options;
    }
    return $this->valueOptions;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.