function 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

1 call to HandlerBase::access()
LanguageFilter::access in core/modules/views/src/Plugin/views/filter/LanguageFilter.php
Check whether given user has access to this handler.
3 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.
LanguageFilter::access in core/modules/views/src/Plugin/views/filter/LanguageFilter.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 571

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'])) {
    // @todo when this is removed return FALSE.
    // See https://www.drupal.org/project/drupal/issues/3547724
    @trigger_error('Passing the access callback using the array key is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. See https://www.drupal.org/node/3539918', E_USER_DEPRECATED);
    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;
}

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