You are here

public function LogMarkAsPending::execute in Log entity 2.x

Executes the plugin.

Overrides ExecutableInterface::execute

File

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

Class

LogMarkAsPending
Action that marks a log as pending.

Namespace

Drupal\log\Plugin\Action

Code

public function execute(LogInterface $log = NULL) {
  if ($log) {
    $log
      ->get('status')
      ->first()
      ->applyTransitionById('to_pending');
    $log
      ->setNewRevision(TRUE);
    $log
      ->save();
  }
}