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

  • 1
    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
    – Clive
    Aug 16, 2021 at 13:51
  • 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?
    – stckvrw
    Aug 16, 2021 at 13:57
  • 2
    See drupal.stackexchange.com/questions/226019/…
    – 4uk4
    Aug 16, 2021 at 14:03
  • @4k4 thank you! Is there a link where I can also read how to get the pages for a view?
    – stckvrw
    Aug 16, 2021 at 14:35
  • 1
    Ok, I've found by myself: $view->getDisplay('page_1')
    – stckvrw
    Aug 16, 2021 at 14:44


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.