You are here

public function DomainEntitySettings::getFormAccess in Domain Access Entity 8

The access check for the form.

Parameters

string $entity_type_id: The entity type ID.

Return value

\Drupal\Core\Access\AccessResultInterface An access result.

Throws

\Symfony\Component\HttpKernel\Exception\NotFoundHttpException

1 string reference to 'DomainEntitySettings::getFormAccess'
domain_entity.routing.yml in ./domain_entity.routing.yml
domain_entity.routing.yml

File

src/Form/DomainEntitySettings.php, line 117

Class

DomainEntitySettings
Provides a form to configure domain fields mappings.

Namespace

Drupal\domain_entity\Form

Code

public function getFormAccess($entity_type_id) {
  $entity_type = $this->entityTypeManager
    ->getDefinition($entity_type_id, FALSE);
  if (!isset($entity_type)) {
    throw new NotFoundHttpException();
  }
  $enabled_types = $this->mapper
    ->getEnabledEntityTypes();
  if (empty($enabled_types[$entity_type_id])) {
    throw new NotFoundHttpException();
  }
  return AccessResult::allowedIfHasPermission($this
    ->currentUser(), 'administer domains');
}