In Drupal, there are two different kinds of blocks: content blocks and plugin blocks.
We get content blocks like this:
and plugin blocks like this:
\Drupal::service('plugin.manager.block')->createInstance( 'plugin_id', $config );
I have a scenario where I don't know whether the block I'm looking for is a content or a plugin. I simply want to obtain the block given its id.
Of course, I can first try one version, test if I found something, an then try the other version.
But the problem to obtain a block by its id should be very common. So, I would expect that there's some builtin Drupal function that I should use. Which one?