2

I have block plugin that renders lazy builder placeholder. In my lazy builder I need to get to the block's settings so I wanted to set the block id as lazy builder argument but it turned out the block instance info is not available to the block plugin itself.

Is there some proper Drupal way how to get to this information beside serializing the configuration as lazy builder argument or storing the configuration elsewhere?

1

No there isn't.

Block plugins can also be used in e.g. page manager and then there's no block entity, it stores configurations for multiple block plugins in a single config entity.

So you shouldn't be relying on the existence of that and instead pass in the relevant configuration to your lazy builder.

0

See https://drupal.stackexchange.com/a/239317/11500, I store the id as a block entity configuration value. That means you can't use those blocks in page manager (which is acceptable for me).

Your Answer

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