class ActionBlock in User Merge 2.x
Class ActionBlock.
@UserMergeAction( id = "action_block", name = @Translation("Block retired account"), )
@package Drupal\usermerge\Plugin\UserMerge\Action
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\usermerge\Plugin\UserMerge\Action\UserMergeActionBase implements UserMergeActionPluginInterface
- class \Drupal\usermerge\Plugin\UserMerge\Action\ActionBlock
- class \Drupal\usermerge\Plugin\UserMerge\Action\UserMergeActionBase implements UserMergeActionPluginInterface
Expanded class hierarchy of ActionBlock
File
- src/
Plugin/ UserMerge/ Action/ ActionBlock.php, line 19
Namespace
Drupal\usermerge\Plugin\UserMerge\ActionView source
class ActionBlock extends UserMergeActionBase {
/**
* {@inheritDoc}
*/
public function process(UserInterface $retired, UserInterface $retained) : void {
if ($retired
->id() == 1) {
throw new UserMergeException('You can not retire user 1.');
}
if ($retired
->id() == $this->currentUser
->id()) {
throw new UserMergeException('You can not retire self.');
}
if (!$retired
->isActive()) {
throw new UserMergeException('The retire user is already blocked.');
}
try {
$retired
->block();
$retired
->save();
} catch (EntityStorageException $e) {
throw new UserMergeException('Am error occurred during status change.');
}
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ActionBlock:: |
public | function |
Process merge on selected property. Overrides UserMergeActionPluginInterface:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
2 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
UserMergeActionBase:: |
protected | property | The current user. | |
UserMergeActionBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
UserMergeActionBase:: |
public | function |
Return the name of the action merge plugin. Overrides UserMergeActionPluginInterface:: |
|
UserMergeActionBase:: |
public | function |
UserMergeActionBase constructor. Overrides PluginBase:: |