1 entity_bundle_layout_access.inc EntityBundleLayoutAccess::checkAccess()

Checks for access based on the available context.

Return value

boolean: The result of the access check.

Overrides LayoutAccess::checkAccess

File

core/modules/layout/plugins/access/entity_bundle_layout_access.inc, line 70
Plugin to provide access control based upon entity bundle.

Class

EntityBundleLayoutAccess
@file Plugin to provide access control based upon entity bundle.

Code

function checkAccess() {
  if (!$this->settings['bundles']) {
    return FALSE;
  }

  /* @var Entity $entity */
  $entity = $this->contexts[$this->entity_type]->data;
  $bundle = $entity->bundle();
  if (!in_array($bundle, $this->settings['bundles'])) {
    return FALSE;
  }

  return TRUE;
}