You are here

public function FieldCollectionItemHostOperationCheck::access in Field collection 8

Same name and namespace in other branches
  1. 8.3 src/Access/FieldCollectionItemHostOperationCheck.php \Drupal\field_collection\Access\FieldCollectionItemHostOperationCheck::access()

Checks access to the operation on the field collection item's host.

Parameters

\Drupal\Core\Session\AccountInterface $account: The currently logged in account.

TODO: Document params

Return value

string A \Drupal\Core\Access\AccessInterface constant value.

File

src/Access/FieldCollectionItemHostOperationCheck.php, line 27

Class

FieldCollectionItemHostOperationCheck
Determines access to operations on the field collection item's host.

Namespace

Drupal\field_collection\Access

Code

public function access(Route $route, AccountInterface $account, $field_collection_item_revision = NULL, FieldCollectionItem $field_collection_item = NULL) {
  $operation = $route
    ->getRequirement('_access_field_collection_item_host');
  return AccessResult::allowedIf($field_collection_item && $field_collection_item
    ->getHost()
    ->access($operation, $account))
    ->cachePerPermissions();
}