public function StickyNode::execute

Executes the plugin.

Overrides ExecutableInterface::execute

File

drupal/core/modules/node/lib/Drupal/node/Plugin/Action/StickyNode.php, line 28
Contains \Drupal\node\Plugin\Action\StickyNode.

Class

StickyNode
Makes a node sticky.

Namespace

Drupal\node\Plugin\Action

Code

public function execute($entity = NULL) {
  $entity->status = NODE_PUBLISHED;
  $entity->sticky = NODE_STICKY;
  $entity
    ->save();
}