function DisplayPluginBase::access

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::access()
  2. 8.9.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::access()
  3. 11.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::access()

Determines if the user has access to this display of the view.

Overrides DisplayPluginInterface::access

1 call to DisplayPluginBase::access()
Attachment::attachTo in core/modules/views/src/Plugin/views/display/Attachment.php
Allows displays to attach to other views.

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 2303

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

public function access(?AccountInterface $account = NULL) {
  if (!isset($account)) {
    $account = \Drupal::currentUser();
  }
  $plugin = $this->getPlugin('access');
  /** @var \Drupal\views\Plugin\views\access\AccessPluginBase $plugin */
  if ($plugin) {
    return $plugin->access($account);
  }
  // Fallback to all access if no plugin.
  return TRUE;
}

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