You are here

public function Bundle::getValueOptions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/filter/Bundle.php \Drupal\views\Plugin\views\filter\Bundle::getValueOptions()

Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.

This can use a guard to be used to reduce database hits as much as possible.

Return value

Return the stored values in $this->valueOptions if someone expects it.

Overrides InOperator::getValueOptions

File

core/modules/views/src/Plugin/views/filter/Bundle.php, line 89
Contains \Drupal\views\Plugin\views\filter\Bundle.

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 = entity_get_bundles($this->entityTypeId);
    $this->valueTitle = $this
      ->t('@entity types', array(
      '@entity' => $this->entityType
        ->getLabel(),
    ));
    $options = array();
    foreach ($types as $type => $info) {
      $options[$type] = $info['label'];
    }
    asort($options);
    $this->valueOptions = $options;
  }
  return $this->valueOptions;
}