You are here

public function ViewsPhp::access in Views PHP 8

Determine if the current user has access or not.

Parameters

\Drupal\Core\Session\AccountInterface $account: The user who wants to access this view.

Return value

bool Returns whether the user has access to the view.

Overrides AccessPluginBase::access

File

src/Plugin/views/access/ViewsPhp.php, line 77
Definition of Drupal\views_php\Plugin\views\access\ViewsPhp.

Class

ViewsPhp
Access plugin that provides access based on PHP code.

Namespace

Drupal\views_php\Plugin\views\access

Code

public function access(AccountInterface $account) {
  if (!empty($this->options['php_access'])) {
    return views_php_check_access($this->options['php_access'], $this->view
      ->id(), $this->view->current_display, $account);
  }
  return TRUE;
}