Score:0

How to get all the pages where a block is placed

gb flag

If I have a block as an entity inside of the function hook_entity_update(), then how to get the paths of all the pages where the block is placed? Can't find an anwser via Google.

Or maybe first I should get the regions? If so, how to get the regions and then the pages?

I see that I have the following four properties inside of the hook_entity_update() when the entity type is block: provider, visibility_tabs, actions and original

cn flag
You'll probably need to crawl the site from the outside to get that information reliably. Drupal doesn't maintain a list of all possible URLs it could serve
stckvrw avatar
gb flag
But there is the tab "Pages" with value(s) when I open configuration page of a block in admin panel. How to get the value(s) programmatically?
4uk4 avatar
cn flag
See https://drupal.stackexchange.com/questions/226019/how-do-i-change-the-visibility-of-an-existing-block-programmatically
stckvrw avatar
gb flag
@4k4 thank you! Is there a link where I can also read how to get the pages for a view?
stckvrw avatar
gb flag
Ok, I've found by myself: `$view->getDisplay('page_1')`
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.