WebformEntityCloseAction.php in Webform 6.x
File
src/Plugin/Action/WebformEntityCloseAction.php
View source
<?php
namespace Drupal\webform\Plugin\Action;
use Drupal\Core\Action\ActionBase;
use Drupal\Core\Session\AccountInterface;
use Drupal\webform\WebformInterface;
class WebformEntityCloseAction extends ActionBase {
public function execute($entity = NULL) {
$entity
->setStatus(WebformInterface::STATUS_CLOSED)
->save();
}
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
$result = $object
->access('update', $account, TRUE);
return $return_as_object ? $result : $result
->isAllowed();
}
}