You are here

public function StateChange::access in Workbench Moderation Actions 8

Same name in this branch
  1. 8 src/Controller/StateChange.php \Drupal\workbench_moderation_actions\Controller\StateChange::access()
  2. 8 src/Plugin/Action/StateChange.php \Drupal\workbench_moderation_actions\Plugin\Action\StateChange::access()

Ensures the user is allowed to make the transition on the entity.

1 string reference to 'StateChange::access'
workbench_moderation_actions.routing.yml in ./workbench_moderation_actions.routing.yml
workbench_moderation_actions.routing.yml

File

src/Controller/StateChange.php, line 72

Class

StateChange
Performs the state change, if user has access to do it.

Namespace

Drupal\workbench_moderation_actions\Controller

Code

public function access($entity_type_id, $entity_id, $from, $to) {
  return AccessResult::allowedIf($this->validation
    ->userMayTransition($from, $to, $this
    ->currentUser()))
    ->cachePerPermissions();
}