You are here

class UserStatus in Open Social 10.2.x

Same name in this branch
  1. 10.2.x modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserStatus.php \Drupal\social_user_export\Plugin\UserExportPlugin\UserStatus
  2. 10.2.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/UserStatus.php \Drupal\social_user\Plugin\GraphQL\DataProducer\UserStatus
Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/UserStatus.php \Drupal\social_user\Plugin\GraphQL\DataProducer\UserStatus
  2. 10.0.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/UserStatus.php \Drupal\social_user\Plugin\GraphQL\DataProducer\UserStatus
  3. 10.1.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/UserStatus.php \Drupal\social_user\Plugin\GraphQL\DataProducer\UserStatus

Returns the status for a user.

Plugin annotation


@DataProducer(
  id = "user_status",
  name = @Translation("User status"),
  description = @Translation("Returns the status of the user."),
  produces = @ContextDefinition("string",
    label = @Translation("User status")
  ),
  consumes = {
    "user" = @ContextDefinition("entity:user",
      label = @Translation("User")
    )
  }
)

Hierarchy

  • class \Drupal\social_user\Plugin\GraphQL\DataProducer\UserStatus extends \Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase implements \Drupal\graphql\Plugin\DataProducerPluginCachingInterface

Expanded class hierarchy of UserStatus

File

modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/UserStatus.php, line 26

Namespace

Drupal\social_user\Plugin\GraphQL\DataProducer
View source
class UserStatus extends DataProducerPluginBase implements DataProducerPluginCachingInterface {

  /**
   * Resolves the value for this data producer.
   *
   * @param \Drupal\user\UserInterface $user
   *   The user to get the status from.
   *
   * @return string
   *   The status of the user ("ACTIVE" or "BLOCKED").
   */
  public function resolve(UserInterface $user) {
    return $user
      ->isActive() ? "ACTIVE" : "BLOCKED";
  }

}

Members

Namesort descending Modifiers Type Description Overrides
UserStatus::resolve public function Resolves the value for this data producer.