1 entity_id_layout_access.inc EntityIDLayoutAccess::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_id_layout_access.inc, line 100
Plugin to provide access control based upon entity ID.

Class

EntityIDLayoutAccess
@file Plugin to provide access control based upon entity ID.

Code

function checkAccess() {
  $key = $this->entity_info['entity keys']['id'];
  $entity = $this->contexts[$this->entity_type]->data;

  if ($this->settings['negate']) {
    return ($entity->$key != $this->settings['entity_id']);
  }
  else {
    return ($entity->$key == $this->settings['entity_id']);
  }
}