You are here

public function FieldCollectionItemHostAddOperationCheck::access in Field collection 8

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

Checks access to add a field collection item to its future 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/FieldCollectionItemHostAddOperationCheck.php, line 42

Class

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

Namespace

Drupal\field_collection\Access

Code

public function access(AccountInterface $account, $host_type, $host_id) {
  $access_control_handler = $this->entityTypeManager
    ->getAccessControlHandler($host_type);
  $host = $this->entityTypeManager
    ->getStorage($host_type)
    ->load($host_id);
  return $access_control_handler
    ->access($host, 'update', $account, TRUE);
}