You are here

public function FieldAccessCheck::access in FileField Sources 8

Checks access.

Parameters

string $entity_type: Entity type.

string $bundle_name: Bundle name.

string $field_name: Field name.

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

Return value

\Drupal\Core\Access\AccessResultInterface AccessResult object

File

src/Access/FieldAccessCheck.php, line 49

Class

FieldAccessCheck
Access check for file field source routes.

Namespace

Drupal\filefield_sources\Access

Code

public function access(string $entity_type, string $bundle_name, string $field_name, AccountInterface $account) {
  $field = $this->entityTypeManager
    ->getStorage('field_config')
    ->load($entity_type . '.' . $bundle_name . '.' . $field_name);
  return $this->entityTypeManager
    ->getAccessControlHandler($entity_type)
    ->fieldAccess('edit', $field, $account, NULL, TRUE);
}