Mercurial > hg > cmmr2012-drupal-site
comparison vendor/chi-teck/drupal-code-generator/templates/d8/hook/block_access.twig @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 /** | |
2 * Implements hook_block_access(). | |
3 */ | |
4 function {{ machine_name }}_block_access(\Drupal\block\Entity\Block $block, $operation, \Drupal\Core\Session\AccountInterface $account) { | |
5 // Example code that would prevent displaying the 'Powered by Drupal' block in | |
6 // a region different than the footer. | |
7 if ($operation == 'view' && $block->getPluginId() == 'system_powered_by_block') { | |
8 return AccessResult::forbiddenIf($block->getRegion() != 'footer')->addCacheableDependency($block); | |
9 } | |
10 | |
11 // No opinion. | |
12 return AccessResult::neutral(); | |
13 } |