WebformEntityUnarchiveAction.php in Webform 6.x
File
src/Plugin/Action/WebformEntityUnarchiveAction.php
View source
<?php
namespace Drupal\webform\Plugin\Action;
use Drupal\Core\Action\ActionBase;
use Drupal\Core\Session\AccountInterface;
class WebformEntityUnarchiveAction extends ActionBase {
public function execute($entity = NULL) {
$entity
->set('archive', FALSE)
->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();
}
}