You are here

class UserFieldsEvent in Social Auth 3.x

Same name and namespace in other branches
  1. 8.2 src/Event/UserFieldsEvent.php \Drupal\social_auth\Event\UserFieldsEvent

Defines the user fields to be set in user creation.

@todo validate user_fields to be set

Hierarchy

Expanded class hierarchy of UserFieldsEvent

See also

\Drupal\social_auth\Event\SocialAuthEvents

1 file declares its use of UserFieldsEvent
UserManager.php in src/User/UserManager.php

File

src/Event/UserFieldsEvent.php, line 14

Namespace

Drupal\social_auth\Event
View source
class UserFieldsEvent extends SocialAuthEventBase {

  /**
   * The user fields.
   *
   * @var array
   */
  protected $userFields;

  /**
   * The plugin id dispatching this event.
   *
   * @var string
   */
  protected $pluginId;

  /**
   * The data of the user to be created.
   *
   * @var \Drupal\social_auth\User\SocialAuthUserInterface
   */
  protected $user;

  /**
   * UserFieldsEvent constructor.
   *
   * @param array $user_fields
   *   Initial user fields to populate the newly created user.
   * @param string $plugin_id
   *   The plugin Id dispatching this event.
   * @param \Drupal\social_auth\User\SocialAuthUserInterface $user
   *   The data of the user to be created.
   */
  public function __construct(array $user_fields, $plugin_id, SocialAuthUserInterface $user) {
    $this->userFields = $user_fields;
    $this->pluginId = $plugin_id;
    $this->user = $user;
  }

  /**
   * Gets the user fields.
   *
   * @return array
   *   Fields to initialize for the user creation.
   */
  public function getUserFields() {
    return $this->userFields;
  }

  /**
   * Sets the user fields.
   *
   * @param array $user_fields
   *   The user fields.
   */
  public function setUserFields(array $user_fields) {
    $this->userFields = $user_fields;
  }

  /**
   * Gets the plugin id dispatching this event.
   *
   * @return string
   *   The plugin id.
   */
  public function getPluginId() {
    return $this->pluginId;
  }

  /**
   * Gets the data of the user to be created.
   *
   * @return \Drupal\social_auth\User\SocialAuthUserInterface
   *   The user's data.
   */
  public function getSocialAuthUser() {
    return $this->user;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
UserFieldsEvent::$pluginId protected property The plugin id dispatching this event.
UserFieldsEvent::$user protected property The data of the user to be created.
UserFieldsEvent::$userFields protected property The user fields.
UserFieldsEvent::getPluginId public function Gets the plugin id dispatching this event.
UserFieldsEvent::getSocialAuthUser public function Gets the data of the user to be created.
UserFieldsEvent::getUserFields public function Gets the user fields.
UserFieldsEvent::setUserFields public function Sets the user fields.
UserFieldsEvent::__construct public function UserFieldsEvent constructor.