I've got a custom block plugin which has some configuration settings that can set from the block configuration form. How can I then access that configuration info later when the block is being rendered? I know that if I know the block's instance id, I can get the configuration data using:
\Drupal::config('blockID'])->getRawData()
However, I'm having trouble finding a hook that can determine the block instance id at the same level as the template so that it can pass that data as a TWIG variable.
I can find the block id inside of HOOK_preprocess_block(&$variables)
, but then I don't know how to pass anything from this hook to the theme template.
Vice versa, if i use HOOK_preprocess_TEMPLATE(&$variables)
, I cannot figure out how to get the block instance id in order to pull the configuration values.
I know what the default block id is and can hard code that into the theme template hook, however, this breaks down if more than one instance of the block is placed into the site. What is the right approach to retrieving block instance configuration settings for use in the theme TWIG template?