You are here

public function Role::summaryTitle in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/src/Plugin/views/access/Role.php \Drupal\user\Plugin\views\access\Role::summaryTitle()

Returns the summary of the settings in the display.

Overrides AccessPluginBase::summaryTitle

File

core/modules/user/src/Plugin/views/access/Role.php, line 84

Class

Role
Access plugin that provides role-based access control.

Namespace

Drupal\user\Plugin\views\access

Code

public function summaryTitle() {
  $count = count($this->options['role']);
  if ($count < 1) {
    return $this
      ->t('No role(s) selected');
  }
  elseif ($count > 1) {
    return $this
      ->t('Multiple roles');
  }
  else {
    $rids = user_role_names();
    $rid = reset($this->options['role']);
    return $rids[$rid];
  }
}