public function ContactFormBlock::blockAccess in Form Block 8
Same name and namespace in other branches
- 2.0.x src/Plugin/Block/ContactFormBlock.php \Drupal\formblock\Plugin\Block\ContactFormBlock::blockAccess()
Indicates whether the block should be shown.
Blocks with specific access checking should override this method rather than access(), in order to avoid repeating the handling of the $return_as_object argument.
Parameters
\Drupal\Core\Session\AccountInterface $account: The user session for which to check access.
Return value
\Drupal\Core\Access\AccessResult The access result.
Overrides BlockPluginTrait::blockAccess
See also
File
- src/
Plugin/ Block/ ContactFormBlock.php, line 205
Class
- ContactFormBlock
- Provides a block for contact form.
Namespace
Drupal\formblock\Plugin\BlockCode
public function blockAccess(AccountInterface $account) {
return AccessResult::allowedIf($this
->getContactForm()
->access('view', $account) && $account
->hasPermission('access site-wide contact form'))
->cachePerPermissions()
->addCacheTags($this
->getContactForm()
->getCacheTags())
->addCacheTags($this->configFactory
->get('contact.settings')
->getCacheTags());
}