You are here

public function HandlerBase::access in Zircon Profile 8

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

Check whether given user has access to this handler.

Parameters

AccountInterface $account: The user account to check.

Return value

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

Overrides ViewsHandlerInterface::access

2 methods override HandlerBase::access()
Field::access in core/modules/views/src/Plugin/views/field/Field.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 482
Contains \Drupal\views\Plugin\views\HandlerBase.

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'], array(
        $account,
      ) + $this->definition['access arguments']);
    }
    return $this->definition['access callback']($account);
  }
  return TRUE;
}