Unpublishes a comment.
@Action(
id = "comment_unpublish_action",
label = @Translation("Unpublish comment"),
type = "comment"
)
Expanded class hierarchy of UnpublishComment
class UnpublishComment extends ActionBase {
/**
* {@inheritdoc}
*/
public function execute($comment = NULL) {
$comment->status->value = COMMENT_NOT_PUBLISHED;
$comment
->save();
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ActionBase:: |
public | function |
Executes the plugin for an array of objects. Overrides ActionInterface:: |
2 |
ContainerFactoryPluginBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
11 |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
public | function |
Returns the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function |
Returns the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Constructs a Drupal\Component\Plugin\PluginBase object. | 17 |
UnpublishComment:: |
public | function |
Executes the plugin. Overrides ExecutableInterface:: |