Found out that one shortcoming of using plugin.manager.block service is that ...

Contribution Date
Technology
Contribution Project
Contribution Details

Found out that one shortcoming of using plugin.manager.block service is that it does not gives the region where the block is placed. The region can only be obtained from the block entity.

Something like this:

$theme_manager = \Drupal::service('theme.manager'); $active_theme = $theme_manager->getActiveTheme()->getName(); $ids = \Drupal::entityQuery('block') ->condition('plugin', 'system_messages_block') ->condition('theme', $active_theme) ->execute();

can be done to check if status messages is placed in the current theme. The result $ids would give the block id, and using the block id the block entity can be loaded, which would give the region where block is placed.

Contribution Author
Files count
0
Patches count
0