We are in good shape
This commit is contained in:
parent
6e2165d8bc
commit
ae775ac022
3 changed files with 40 additions and 15 deletions
|
@ -520,8 +520,7 @@ Note: It helps you think through what you are planning to do, it makes features
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
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: 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 290 hooks in Drupal 11, up two from 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 are still adding hooks sligtly faster than deprecating and removing them. Hooks are still very much a part of Drupal. Every contributed module can provide hooks, too.
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -529,27 +528,31 @@ Hooks work by naming convention.
|
||||||
|
|
||||||
To implement a hook, take the 'hook' part off the hook name and replace it with your module's (machine) name.
|
To implement a hook, take the 'hook' part off the hook name and replace it with your module's (machine) name.
|
||||||
|
|
||||||
|
Or do it the new way!
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 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/11.0.x) of what tools are available to you as you pick through the pieces Drupal offers and assemble your module.
|
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/11.0.x) of what tools are available to you as you pick through the pieces Drupal offers and assemble your module.
|
||||||
|
|
||||||
https://api.drupal.org/api/drupal/core%21core.api.php/group/extending/
|
[api.drupal.org/api/drupal/core!core.api.php/group/extending](https://api.drupal.org/api/drupal/core%21core.api.php/group/extending/)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Key hooks
|
### Key hooks
|
||||||
|
|
||||||
* [hook form_alter](https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21form.api.php/function/hook_form_alter/11.0.x)
|
* [hook form_alter](https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21form.api.php/function/hook_form_alter/11.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/11.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/11.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 three hooks with one plugin by using the [Extra field module](https://www.drupal.org/project/extra_field )
|
||||||
|
|
||||||
### All the hooks
|
### 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/)
|
* [api.drupal.org/api/drupal/core!core.api.php/group/hooks](https://api.drupal.org/api/drupal/core!core.api.php/group/hooks/)
|
||||||
|
|
||||||
|
|
||||||
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
|
Note: A note on all these links: I've linked to the Drupal 11.0 version. These hooks almost all work in Drupal 10.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 you are open to upgrading.
|
||||||
|
|
||||||
|
That 'all the hooks' link also shows how to implement hooks in the modern method.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -563,19 +566,17 @@ In your `*.info.yml`
|
||||||
core_version_requirement: ^10.2 || ^11
|
core_version_requirement: ^10.2 || ^11
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: And i'm not talking about Drupal 7, 6, 5, or 4.7. Don't bother with Drupal 10 if you want to use the new cool object-oriented style hooks that came in Drupal 11.1. Some good stuff came in Drupal 10.2, so this exact line is common right now, and if you are making a new module you would not be excluding anybody really to start with this.
|
Note: And i'm not talking about Drupal 7, 6, 5, or 4.7. Modern Drupal starts with Drupal 8, but don't bother with Drupal 10 if you want to use the new cool object-oriented style hooks that came in Drupal 11.1. Some good stuff came in Drupal 10.2, so this exact line is common right now, and if you are making a new module you would not be excluding anybody really to start with this.
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
### Bonus bonus tip
|
|
||||||
|
|
||||||
#### Read Drupal Core Release Notes
|
#### Read Drupal Core Release Notes
|
||||||
|
|
||||||
[drupal.org/project/drupal/releases](https://www.drupal.org/project/drupal/releases)
|
[drupal.org/project/drupal/releases](https://www.drupal.org/project/drupal/releases)
|
||||||
|
|
||||||
"This is a **a feature minor release of Drupal 11**" are the sorts of words you are looking for.
|

|
||||||
|
|
||||||
|
|
||||||
|
Note: Bonus bonus tip. "This is a **a feature minor release of Drupal 11**" are the sorts of words you are looking for, the "New features" tag. You can also read release notes in alpha, beta, and release candidate versions to see what's coming; dev releases are rolling and do not have release notes. The insecure tag is simply because there have been security patches since then but has no bearing on the information in the release notes generally.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -587,14 +588,15 @@ Note: And i'm not talking about Drupal 7, 6, 5, or 4.7. Don't bother with Drupa
|
||||||
* [agaric.coop/blog](https://agaric.coop/blog)
|
* [agaric.coop/blog](https://agaric.coop/blog)
|
||||||
* Your own notes
|
* Your own notes
|
||||||
|
|
||||||
|
Note: Get your notes on the Internet so you can find them again! This happens to me *constantly*.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Copy or have technology copy for you
|
### Copy or have technology copy for you
|
||||||
|
|
||||||
* A module that was generated with Drupal Console https://www.drupal.org/project/ckeditor_youtube/ - simple and used by many, and slowly got more complex
|
[drupal.org/project/module_builder](drupal.org/project/module_builder)
|
||||||
|
|
||||||
Note: Shows how a lot of this is boilerplate.
|
|
||||||
|
|
||||||
|
Note: Shows how a lot of this is boilerplate. Drupal Console used to be the go-to for this; https://www.drupal.org/project/ckeditor_youtube/ is simple and used by many, it was a pure Drupal Console creation to start and has slowly gotten more complex. I hear there's some other tools out there that will burn venture capitalist cash to write code for you, unfortunately accellerating the boiling of our planet and ripping most all of creative humanity off, without credit, while doing so.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -718,16 +720,39 @@ UnderstandDrupal.com shameless plug
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Maintaining
|
## Maintaining
|
||||||
|
|
||||||
Note: Isn't that the most anyone can ask of us these days, to maintain?
|
Note: Isn't that the most anyone can ask of us these days, to maintain?
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
#### Join `#maintainers` channel in Drupal Slack
|
### Join `#maintainers` channel in Drupal Slack
|
||||||
|
|
||||||
|
via Greg Boggs who notes that he and Damien McKenna provide free support to module maintainers
|
||||||
|
|
||||||
Note: That is the effective takeway from this entire section, because most of the tips in this section come from people in that channel.
|
Note: That is the effective takeway from this entire section, because most of the tips in this section come from people in that channel.
|
||||||
|
|
||||||
|
I hate to recommend people get on proprietary services, but Slack at least is not as far as i know run by baddies actively colluding to throw orphans and widows off of social security.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
### You can start / leave your module in "Sandbox" mode
|
||||||
|
|
||||||
|
You do not have to make your module a full project right away.
|
||||||
|
|
||||||
|
(but i do)
|
||||||
|
|
||||||
|
Note: I generally do as soon as i have
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
“Lord, give me the confidence of a mediocre white man.”
|
||||||
|
— Sarah Hagi
|
||||||
|
|
||||||
|
Note: I hereby grant you this confidence.
|
||||||
|
|
||||||
|
https://lithub.com/ijeoma-oluo-on-the-pervasive-impact-of-white-mediocrity/
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
#### Be explicit about your level of support
|
#### Be explicit about your level of support
|
||||||
|
|
BIN
content/images/drupal-org-module-level-support.png
Normal file
BIN
content/images/drupal-org-module-level-support.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 89 KiB |
BIN
content/images/drupal-releases.png
Normal file
BIN
content/images/drupal-releases.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 243 KiB |
Loading…
Add table
Add a link
Reference in a new issue