You are here

public function ComplexEntityFormModes::accessIsAllowed in Form mode manager 8.2

Evaluate if current user has access to this bundle AND form mode.

Parameters

string $entity_type_id: The id of current entity.

string $bundle_name: The name of current bundle need to access.

string $form_mode_name: The form mode name to use.

Return value

bool True if you can access to this entity type as given form mode.

1 call to ComplexEntityFormModes::accessIsAllowed()
ComplexEntityFormModes::addPage in src/ComplexEntityFormModes.php

File

src/ComplexEntityFormModes.php, line 96

Class

ComplexEntityFormModes
Route controller factory specific for each entities using bundles.

Namespace

Drupal\form_mode_manager

Code

public function accessIsAllowed($entity_type_id, $bundle_name, $form_mode_name) {
  $access = $this->entityTypeManager
    ->getAccessControlHandler($entity_type_id)
    ->createAccess($bundle_name, $this->account, [], TRUE);
  return $access
    ->isAllowed() && $this->formModeManager
    ->isActive($entity_type_id, $bundle_name, $form_mode_name);
}