public function TablefieldController::access in TableField 8.2
Check access to the export page.
Parameters
\Drupal\Core\Session\AccountInterface $account: The account to check.
\Drupal\Core\Entity\EntityInterface $entity: The entity to check the permission for view.
string $field_name: The machine name of the field to load.
Return value
\Drupal\Core\Access\AccessResultInterface The Access check results.
1 string reference to 'TablefieldController::access'
File
- src/
Controller/ TablefieldController.php, line 29
Class
- TablefieldController
- Controller routines for tablefield routes.
Namespace
Drupal\tablefield\ControllerCode
public function access(AccountInterface $account, EntityInterface $entity, $field_name) {
if (!$entity instanceof FieldableEntityInterface) {
return AccessResult::forbidden();
}
// Check if field is a tablefield.
if (!($fieldDefinition = $entity
->getFieldDefinition($field_name)) || $fieldDefinition
->getType() !== 'tablefield') {
return AccessResult::forbidden();
}
return $entity
->access('view', $account, TRUE);
}