You are here

public function AssignOwnerNode::execute in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/node/src/Plugin/Action/AssignOwnerNode.php \Drupal\node\Plugin\Action\AssignOwnerNode::execute()
  2. 10 core/modules/node/src/Plugin/Action/AssignOwnerNode.php \Drupal\node\Plugin\Action\AssignOwnerNode::execute()

Executes the plugin.

Overrides ExecutableInterface::execute

File

core/modules/node/src/Plugin/Action/AssignOwnerNode.php, line 61

Class

AssignOwnerNode
Assigns ownership of a node to a user.

Namespace

Drupal\node\Plugin\Action

Code

public function execute($entity = NULL) {

  /** @var \Drupal\node\NodeInterface $entity */
  $entity
    ->setOwnerId($this->configuration['owner_uid'])
    ->save();
}