You are here

public function EntityBreakLockForm::access in Content locking (anti-concurrent editing) 8

Same name and namespace in other branches
  1. 8.2 src/Form/EntityBreakLockForm.php \Drupal\content_lock\Form\EntityBreakLockForm::access()

Custom access checker for the form route requirements.

File

src/Form/EntityBreakLockForm.php, line 152

Class

EntityBreakLockForm
Provides a base class for break content lock forms.

Namespace

Drupal\content_lock\Form

Code

public function access(ContentEntityInterface $entity, $langcode, $form_op, AccountInterface $account) {
  return AccessResult::allowedIf($account
    ->hasPermission('break content lock') || $this->lockService
    ->isLockedBy($entity
    ->id(), $langcode, $form_op, $account
    ->id(), $entity
    ->getEntityTypeId()));
}