You are here

public function HandlerBase::access in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::access()

Check whether given user has access to this handler.

Parameters

\Drupal\Core\Session\AccountInterface $account: The user account to check.

Return value

bool TRUE if the user has access to the handler, FALSE otherwise.

Overrides ViewsHandlerInterface::access

4 methods override HandlerBase::access()
EntityField::access in core/modules/views/src/Plugin/views/field/EntityField.php
Check whether given user has access to this handler.
NodeCounterTimestamp::access in core/modules/statistics/src/Plugin/views/field/NodeCounterTimestamp.php
Check whether given user has access to this handler.
StatisticsNumeric::access in core/modules/statistics/src/Plugin/views/field/StatisticsNumeric.php
Check whether given user has access to this handler.
TestExample::access in core/modules/views/tests/modules/views_test_data/src/Plugin/views/area/TestExample.php
Check whether given user has access to this handler.

File

core/modules/views/src/Plugin/views/HandlerBase.php, line 465

Class

HandlerBase
Base class for Views handler plugins.

Namespace

Drupal\views\Plugin\views

Code

public function access(AccountInterface $account) {
  if (isset($this->definition['access callback']) && function_exists($this->definition['access callback'])) {
    if (isset($this->definition['access arguments']) && is_array($this->definition['access arguments'])) {
      return call_user_func_array($this->definition['access callback'], [
        $account,
      ] + $this->definition['access arguments']);
    }
    return $this->definition['access callback']($account);
  }
  return TRUE;
}