1 EntityReferenceSelectionHandlerGeneric.inc public EntityReferenceSelectionHandlerGeneric_node::entityFieldQueryAlter(SelectQueryInterface $query)

Implements EntityReferenceHandler::entityFieldQueryAlter().

Overrides EntityReferenceSelectionHandlerGeneric::entityFieldQueryAlter

File

core/modules/entityreference/plugins/selection/EntityReferenceSelectionHandlerGeneric.inc, line 365
Generic Entity handler.

Class

EntityReferenceSelectionHandlerGeneric_node
Override for the Node type.

Code

public function entityFieldQueryAlter(SelectQueryInterface $query) {
  // Adding the 'node_access' tag is insufficient for nodes: need to also
  // know about the concept of 'published' and 'unpublished' if there are
  // no access control modules in use.
  if (!user_access('bypass node access') && !count(module_implements('node_grants'))) {
    $base_table = $this->ensureBaseTable($query);
    $query->condition("$base_table.status", NODE_PUBLISHED);
  }
}