You are here

public function SetCustomPublishOptionValue::execute in Custom Publishing Options 8

Executes the plugin.

Overrides ExecutableInterface::execute

File

src/Plugin/Action/SetCustomPublishOptionValue.php, line 23

Class

SetCustomPublishOptionValue
Sets the custom publishing option on a node to a given value.

Namespace

Drupal\custom_pub\Plugin\Action

Code

public function execute($node = NULL) {
  $option = $this->configuration['option'];
  $value = $this->configuration['value'];
  $node->{$option} = (bool) $value;
  $node
    ->save();
}