You are here

function ief_table_view_mode_entity_view_mode_access in Inline Entity Form Table View Mode 8.2

Implements hook_ENTITY_TYPE_access() for entity_view_mode.

File

./ief_table_view_mode.module, line 113
Defines a view mode to set up the columns of the table for the IEF widget.

Code

function ief_table_view_mode_entity_view_mode_access(EntityInterface $entity, $operation, AccountInterface $account) {
  if ($entity
    ->getTargetType() . '.' . EntityInlineTableViewModeForm::IEF_TABLE_VIEW_MODE_NAME == $entity
    ->id()) {
    if ($operation == 'delete') {
      return AccessResult::forbidden();
    }
  }
  return AccessResult::neutral();
}