You are here

public function EntityBundle::access in Commerce Core 8.2

Same name in this branch
  1. 8.2 src/Plugin/views/filter/EntityBundle.php \Drupal\commerce\Plugin\views\filter\EntityBundle::access()
  2. 8.2 src/Plugin/views/field/EntityBundle.php \Drupal\commerce\Plugin\views\field\EntityBundle::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 EntityField::access

File

src/Plugin/views/field/EntityBundle.php, line 114

Class

EntityBundle
Displays the entity bundle.

Namespace

Drupal\commerce\Plugin\views\field

Code

public function access(AccountInterface $account) {
  $bundles = $this->entityTypeBundleInfo
    ->getBundleInfo($this
    ->getEntityType());
  if ($this->options['hide_single_bundle'] && count($bundles) <= 1) {
    return FALSE;
  }
  return parent::access($account);
}