-2

In Blocks are now plugins, under API changes, I read the following:

  • hook_block_info_alter() has been removed. The administrative label can be changed with the new hook_block_alter(). Most other properties (cache, visibility etc) can be changed on the configuration entity save or load: hook_block_presave(), hook_block_insert(), hook_block_update() (or even hook_block_load for very dynamic cases).

Searching on api.drupal.org for hook_block_alter, I don't get anything. Since the change record has been created on October, 2014 and last updated on September, 2015 I wonder:

  • Is hook_block_alter() still invoked?
  • In the case the answer is no, what replaced it?
2

It might not be documented, but it definitely exists.

See \Drupal\Core\Block\BlockManager::__construct():

$this->alterInfo('block');

That line sets the name for the standard plugin alter hook that pretty much all plugin types support.

| improve this answer | |
  • I was trying to find the service that handles the blocks by default, but I didn't think its name could start with plugin. – kiamlaluno Mar 16 '16 at 8:23
  • When looking for a plugin manager and you don't know which one it is, the easiest might be to look for usages of the annotation class or plugin folder names. – Berdir Mar 16 '16 at 9:43

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.