class CancelUser

Cancels a user account.

Plugin annotation


@Action(
  id = "user_cancel_user_action",
  label = @Translation("Cancel the selected user accounts"),
  type = "user",
  confirm_form_path = "admin/people/cancel"
)

Hierarchy

Expanded class hierarchy of CancelUser

File

drupal/core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php, line 26
Contains \Drupal\user\Plugin\Action\CancelUser.

Namespace

Drupal\user\Plugin\Action
View source
class CancelUser extends ActionBase {

  /**
   * The tempstore factory.
   *
   * @var \Drupal\user\TempStoreFactory
   */
  protected $tempStoreFactory;

  /**
   * Constructs a DeleteNode object.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin ID for the plugin instance.
   * @param array $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\user\TempStoreFactory $temp_store_factory
   *   The tempstore factory.
   */
  public function __construct(array $configuration, $plugin_id, array $plugin_definition, TempStoreFactory $temp_store_factory) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->tempStoreFactory = $temp_store_factory;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('user.tempstore'));
  }

  /**
   * {@inheritdoc}
   */
  public function executeMultiple(array $entities) {
    $this->tempStoreFactory
      ->get('user_user_operations_cancel')
      ->set($GLOBALS['user']->uid, $entities);
  }

  /**
   * {@inheritdoc}
   */
  public function execute($object = NULL) {
    $this
      ->executeMultiple(array(
      $object,
    ));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CancelUser::$tempStoreFactory protected property The tempstore factory.
CancelUser::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginBase::create
CancelUser::execute public function Executes the plugin. Overrides ExecutableInterface::execute
CancelUser::executeMultiple public function Executes the plugin for an array of objects. Overrides ActionBase::executeMultiple
CancelUser::__construct public function Constructs a DeleteNode object. Overrides PluginBase::__construct
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition.
PluginBase::$pluginId protected property The plugin_id.
PluginBase::getPluginDefinition public function Returns the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition
PluginBase::getPluginId public function Returns the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId