function tca_node_query_search_node_search_alter in Token Content Access 2.0.x
Same name and namespace in other branches
- 8 modules/tca_node/tca_node.module \tca_node_query_search_node_search_alter()
Implements hook_query_TAG_alter().
File
- modules/
tca_node/ tca_node.module, line 36 - Contains tca_node.module.
Code
function tca_node_query_search_node_search_alter(AlterableInterface $query) {
$account = \Drupal::currentUser();
$bypass_permitted = $account
->hasPermission('tca bypass node');
if (!$bypass_permitted) {
$disabled_types = _tca_node_get_disabled_types();
$group = $query
->orConditionGroup()
->condition('n.tca_active', NULL, 'IS NULL')
->condition('n.tca_active', 0)
->condition('n.type', $disabled_types, 'IN');
$query
->condition($group);
}
}