You are here

class UserFromWrapper in Open Social 10.2.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/UserFromWrapper.php \Drupal\social_user\Plugin\GraphQL\DataProducer\UserFromWrapper
  2. 10.1.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/UserFromWrapper.php \Drupal\social_user\Plugin\GraphQL\DataProducer\UserFromWrapper

Get the user information from a relationship.

Plugin annotation


@DataProducer(
  id = "user_from_wrapper",
  name = @Translation("User from data structure"),
  description = @Translation("The user information for a UserAwareInterface implementing type."),
  produces = @ContextDefinition("entity:user",
    label = @Translation("User entity")
  ),
  consumes = {
    "data" = @ContextDefinition("any",
      label = @Translation("Data"),
      description = @Translation("A class instance containing user information."),
      required = TRUE
    )
  }
)

Hierarchy

  • class \Drupal\social_user\Plugin\GraphQL\DataProducer\UserFromWrapper extends \Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase

Expanded class hierarchy of UserFromWrapper

File

modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/UserFromWrapper.php, line 28

Namespace

Drupal\social_user\Plugin\GraphQL\DataProducer
View source
class UserFromWrapper extends DataProducerPluginBase {

  /**
   * Resolves the value.
   *
   * @param \Drupal\social_user\Wrappers\UserAwareInterface $data
   *   A class that contains user information.
   *
   * @return \Drupal\user\UserInterface|null
   *   The user entity.
   */
  public function resolve(UserAwareInterface $data) : ?UserInterface {
    return $data
      ->getUser();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
UserFromWrapper::resolve public function Resolves the value.