You are here

public function UserRoles::resolve in Open Social 10.0.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/UserRoles.php \Drupal\social_user\Plugin\GraphQL\DataProducer\UserRoles::resolve()
  2. 10.1.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/UserRoles.php \Drupal\social_user\Plugin\GraphQL\DataProducer\UserRoles::resolve()
  3. 10.2.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/UserRoles.php \Drupal\social_user\Plugin\GraphQL\DataProducer\UserRoles::resolve()

Resolves the value for this data producer.

Parameters

\Drupal\user\UserInterface $user: The user to get the roles for.

Return value

string[] The roles the user has.

File

modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/UserRoles.php, line 37

Class

UserRoles
Returns the roles for a user.

Namespace

Drupal\social_user\Plugin\GraphQL\DataProducer

Code

public function resolve(UserInterface $user) {
  return $user
    ->getRoles();
}