You are here

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

Executes the plugin.

Overrides ExecutableInterface::execute

File

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

Class

LogMarkAsDone
Action that marks a log as done.

Namespace

Drupal\log\Plugin\Action

Code

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