public function Store::access in Commerce Core 8.2
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
- modules/
store/ src/ Plugin/ views/ field/ Store.php, line 46
Class
- Store
- Displays the store.
Namespace
Drupal\commerce_store\Plugin\views\fieldCode
public function access(AccountInterface $account) {
$store_query = $this->entityTypeManager
->getStorage('commerce_store')
->getQuery();
$store_count = $store_query
->count()
->accessCheck(TRUE)
->execute();
if ($this->options['hide_single_store'] && $store_count <= 1) {
return FALSE;
}
return parent::access($account);
}