function NodeViewsExecutionHooks::viewsQuerySubstitutions

Implements hook_views_query_substitutions().

File

core/modules/node/src/Hook/NodeViewsExecutionHooks.php, line 16

Class

NodeViewsExecutionHooks
Hook implementations for node.

Namespace

Drupal\node\Hook

Code

public function viewsQuerySubstitutions(ViewExecutable $view) {
    $account = \Drupal::currentUser();
    return [
        '***ADMINISTER_NODES***' => intval($account->hasPermission('administer nodes')),
        '***VIEW_OWN_UNPUBLISHED_NODES***' => intval($account->hasPermission('view own unpublished content')),
        '***BYPASS_NODE_ACCESS***' => intval($account->hasPermission('bypass node access')),
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.