You are here

class AccountId in Open Social 10.1.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/AccountId.php \Drupal\social_user\Plugin\GraphQL\DataProducer\AccountId
  2. 10.0.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/AccountId.php \Drupal\social_user\Plugin\GraphQL\DataProducer\AccountId
  3. 10.2.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/AccountId.php \Drupal\social_user\Plugin\GraphQL\DataProducer\AccountId

Retrieves the user ID for an account instance.

Plugin annotation


@DataProducer(
  id = "account_id",
  name = @Translation("Account identifier"),
  description = @Translation("Returns the account identifier."),
  produces = @ContextDefinition("string",
    label = @Translation("Identifier")
  ),
  consumes = {
    "account" = @ContextDefinition("any",
      label = @Translation("AccountInterface instance")
    )
  }
)

Hierarchy

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

Expanded class hierarchy of AccountId

File

modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/AccountId.php, line 25

Namespace

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

  /**
   * Resolves the request to the requested values.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The account to get the id for.
   *
   * @return mixed
   *   The user id.
   */
  public function resolve(AccountInterface $account) {
    return $account
      ->id();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AccountId::resolve public function Resolves the request to the requested values.