You are here

public function SaveSearch::access in Search API Saved Searches 8

Overrides BlockPluginTrait::access

File

src/Plugin/Block/SaveSearch.php, line 205

Class

SaveSearch
Displays the "Save search" form in a block.

Namespace

Drupal\search_api_saved_searches\Plugin\Block

Code

public function access(AccountInterface $account, $return_as_object = FALSE) {
  $access = parent::access($account, TRUE);
  $create_access = $this
    ->getEntityTypeManager()
    ->getAccessControlHandler('search_api_saved_search')
    ->createAccess($this->configuration['type'], $account, [], TRUE);
  $access = $access
    ->andIf($create_access);
  return $return_as_object ? $access : $access
    ->isAllowed();
}