function Roles::getValueOptions

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

Gets the value options.

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

core/modules/user/src/Plugin/views/filter/Roles.php, line 55

Class

Roles
Filter handler for user roles.

Namespace

Drupal\user\Plugin\views\filter

Code

public function getValueOptions() {
    $this->valueOptions = user_role_names(TRUE);
    unset($this->valueOptions[RoleInterface::AUTHENTICATED_ID]);
    return $this->valueOptions;
}

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