public function SelectionEntityTypeNode::entityFieldQueryAlter in Entity reference 8
Implements EntityReferenceHandler::entityFieldQueryAlter().
Overrides SelectionBase::entityFieldQueryAlter
File
- lib/
Drupal/ entityreference/ Plugin/ Type/ Selection/ SelectionEntityTypeNode.php, line 19 - Definition of Drupal\entityreference\Plugin\entityreference\selection\SelectionEntityTypeNode.
Class
Namespace
Drupal\entityreference\Plugin\Type\SelectionCode
public function entityFieldQueryAlter(AlterableInterface $query) {
// Adding the 'node_access' tag is sadly insufficient for nodes: core
// requires us to also know about the concept of 'published' and
// 'unpublished'. We need to do that as long as there are no access control
// modules in use on the site. As long as one access control module is there,
// it is supposed to handle this check.
if (!user_access('bypass node access') && !count(module_implements('node_grants'))) {
$tables = $query
->getTables();
$query
->condition(key($tables) . '.status', NODE_PUBLISHED);
}
}