Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / block_access.twig
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 }