You are here

protected function UserRole::getRoleNames in Feeds 8.3

Returns a list of role names, keyed by role ID.

Return value

array A list of role names.

3 calls to UserRole::getRoleNames()
UserRole::buildConfigurationForm in src/Feeds/Target/UserRole.php
Form constructor.
UserRole::defaultConfiguration in src/Feeds/Target/UserRole.php
Gets default configuration for this plugin.
UserRole::getSummary in src/Feeds/Target/UserRole.php
Returns the summary for a target.

File

src/Feeds/Target/UserRole.php, line 170

Class

UserRole
Defines a user role mapper.

Namespace

Drupal\feeds\Feeds\Target

Code

protected function getRoleNames() {
  $roles = $this->entityTypeManager
    ->getStorage('user_role')
    ->loadMultiple();
  unset($roles[RoleInterface::ANONYMOUS_ID]);
  unset($roles[RoleInterface::AUTHENTICATED_ID]);
  return array_map(function ($item) {
    return $item
      ->label();
  }, $roles);
}