Get too verbose

This commit is contained in:
benjamin melançon 2020-05-01 00:11:37 -04:00
parent 4d647bb8f2
commit 48f9bba4f9

View file

@ -233,6 +233,8 @@ And knowing where to paste unleashes the power of Stack Overflow / Stack Exchang
Knowing where to put this code unleashes the power of Stack Overflow. Knowing where to put this code unleashes the power of Stack Overflow.
You now know enough to be dangerous. You now know enough to be dangerous.
And i hope i have definitively slayed (slewn?) the mythology that module-making is a mystic domain of Drupal druids.
{{% /note %}} {{% /note %}}
@ -486,12 +488,33 @@ class Copyright extends BlockBase {
} }
``` ```
---
![Cat waving paws at mirror with the text Magic Portal: Activate! superimposed.](images/magic-portal-cat.jpg)
{{% note %}}
Hooks are magic portals that let any module appear in another part of Drupal and do something.
More technically, a hook is tied to some sort of Drupal event and is an opportunity for our module to take action.
There were 251+ hooks in Drupal 7 core.
After a concerted effort in the development of Drupal 8 to remove hooks and replace them with more modern and widespread (outside Drupal) programming practices such as plugins and services...
There are now 288 hooks in Drupal 8.8.
To be fair, we moved some big contributed modules like Views into Drupal core ... but even after that, we've added 25 hooks to core since Drupal 8.2 (and only deprecated 9, which are removed in Drupal 9). Hooks are still very much a part of Drupal.
Every contributed module can provide hooks, too.
{{% /note %}}
--- ---
## Resources ## Resources
Most of these links go to a page on [Drupal's API reference which is also a great place to go for an overview](https://api.drupal.org/api/drupal/9.0.x) of what tools are available to you as you stretch and . Most of these links go to a page on [Drupal's API reference which is also a great place to go for an overview](https://api.drupal.org/api/drupal/9.0.x) of what tools are available to you as you pick through the pieces Drupal offers and assemble your module.
--- ---
@ -500,6 +523,10 @@ Most of these links go to a page on [Drupal's API reference which is also a grea
* [hook form_alter](https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21form.api.php/function/hook_form_alter/9.0.x ) * [hook form_alter](https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21form.api.php/function/hook_form_alter/9.0.x )
* [hook_entity_extra_field_info](https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21entity.api.php/function/hook_entity_extra_field_info/9.0.x ) + a 'field' site builders can use in entity view modes, such as to combine entity data and format it for display. Or you can replace those three hooks with one plugin by using the [Extra field module](https://www.drupal.org/project/extra_field ) * [hook_entity_extra_field_info](https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21entity.api.php/function/hook_entity_extra_field_info/9.0.x ) + a 'field' site builders can use in entity view modes, such as to combine entity data and format it for display. Or you can replace those three hooks with one plugin by using the [Extra field module](https://www.drupal.org/project/extra_field )
### All the hooks
* [api.drupal.org/api/drupal/core!core.api.php/group/hooks](https://api.drupal.org/api/drupal/core!core.api.php/group/hooks/)
{{% note %}} {{% note %}}
A note on all these links: I've linked to the Drupal 9.0 version. These hooks all work in Drupal 8.x also. Drupal.org [inadvertently for quite a while treated 8.2 as the end-all-and-be-all version of Drupal](https://www.drupal.org/project/apidrupalorg/issues/3085999 ); this has been mitigated and is being fixed but Google is still likely to take you to 8.2 when searching for documentation on a hook. Just switch to the version you're using, or the latest version of Drupal if A note on all these links: I've linked to the Drupal 9.0 version. These hooks all work in Drupal 8.x also. Drupal.org [inadvertently for quite a while treated 8.2 as the end-all-and-be-all version of Drupal](https://www.drupal.org/project/apidrupalorg/issues/3085999 ); this has been mitigated and is being fixed but Google is still likely to take you to 8.2 when searching for documentation on a hook. Just switch to the version you're using, or the latest version of Drupal if
@ -507,6 +534,7 @@ A note on all these links: I've linked to the Drupal 9.0 version. These hooks a
--- ---
### Edit hook ### Edit hook
@TODO @TODO