You are here

public function Menu::getValueOptions in Menu Entity Index 8

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

array|null The stored values from $this->valueOptions.

Overrides InOperator::getValueOptions

File

src/Plugin/views/filter/Menu.php, line 78

Class

Menu
Filter class which allows filtering by menu name.

Namespace

Drupal\menu_entity_index\Plugin\views\filter

Code

public function getValueOptions() {
  if (!isset($this->valueOptions)) {
    $options = $this->tracker
      ->getAvailableMenus();
    if ($this->trackedOnly) {
      $tracked_menus = $this->tracker
        ->getTrackedMenus();
      $options = array_filter($options, function ($key) use ($tracked_menus) {
        return in_array($key, $tracked_menus);
      }, ARRAY_FILTER_USE_KEY);
    }
    $this->valueOptions = $options;
  }
  return $this->valueOptions;
}