node.views_execution.inc 563 B

1234567891011121314151617181920
  1. <?php
  2. /**
  3. * @file
  4. * Provide views runtime hooks for node.module.
  5. */
  6. use Drupal\views\ViewExecutable;
  7. /**
  8. * Implements hook_views_query_substitutions().
  9. */
  10. function node_views_query_substitutions(ViewExecutable $view) {
  11. $account = \Drupal::currentUser();
  12. return [
  13. '***ADMINISTER_NODES***' => intval($account->hasPermission('administer nodes')),
  14. '***VIEW_OWN_UNPUBLISHED_NODES***' => intval($account->hasPermission('view own unpublished content')),
  15. '***BYPASS_NODE_ACCESS***' => intval($account->hasPermission('bypass node access')),
  16. ];
  17. }