Thanks for suggestion, but I've checked that page several times and it doesn't offer this option. I'm talking about publishing options, when an article is unpublished, some blocks should remain hidden.
having the same problem here...
I would like to hide all the blocks associated with one page I have... Since the page is not published yet... I don't want the blocks to be seen either.
function my_module_block_access(\Drupal\block\Entity\Block $block, $operation, \Drupal\Core\Session\AccountInterface $account) {
if ($block->id() == 'my_block_id') {
$node = \Drupal::routeMatch()->getParameter('node');
// Hide the block if the node is not published
if (($node instanceof \Drupal\node\NodeInterface) && ($node->isPublished() == FALSE)) {
return AccessResult::forbiddenIf(true)->addCacheableDependency($block);
}
}
}
Comments
Show block only to certain role(s), user(s), etc...
I am not sure this is what you wanted but it is worth a try: http://drupal.org/node/64135
Thanks for suggestion, but
Thanks for suggestion, but I've checked that page several times and it doesn't offer this option. I'm talking about publishing options, when an article is unpublished, some blocks should remain hidden.
– – – – – – – – – – – – – – – – –
smart reviews for serious gamers
www.gamecritics.com
having the same problem
having the same problem here...
I would like to hide all the blocks associated with one page I have... Since the page is not published yet... I don't want the blocks to be seen either.
Subscribe
Looking for a similar solution for Drupal 8.
For Drupal 8:
For Drupal 8: