From 199da5ba075c4b81d0ff01da8090167526f6fec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Fri, 1 May 2020 00:37:26 -0400 Subject: [PATCH] Steal, steal, steal from my old presentations --- blog-when-not-a-module-for-that-resources.md | 64 ++++++++++++++++++++ content/_index.md | 28 ++++++++- 2 files changed, 91 insertions(+), 1 deletion(-) diff --git a/blog-when-not-a-module-for-that-resources.md b/blog-when-not-a-module-for-that-resources.md index de98e00..d5a7276 100644 --- a/blog-when-not-a-module-for-that-resources.md +++ b/blog-when-not-a-module-for-that-resources.md @@ -48,3 +48,67 @@ contributed-module-ideas You are having an effect on the world. Or at least your local site. + +## Getting help + +The Internet. + +It's good. + + +### Tip: Looking up Hooks + +We can look up hook definitions and their function signatures the same way we look up Drupal functions, at api.drupal.org: + +api.drupal.org/hook_help + + api.drupal.org + drupalcontrib.org + + +### Examples project + +[drupal.org/project/examples](https://www.drupal.org/project/examples) + + +Tip: grep + +grep -nHR module_implements_alter . + +./includes/module.inc:646: if ($hook != 'module_implements_alter') { + +./modules/system/system.api.php:1775:function hook_module_implements_alter(&$implementations, $hook) { + + +### Tip: Clear Caches + +If something you do has no effect... + +`drush cr` + + +## Coding Standards + + +drupal.org/coding-standards + +Automated Nagging + +drupal.org/project/coder + +Automatic Adherence + +drupal.org/project/grammar_parser +(obsolete?) + + + + + + + +The most important thing about this code is that i stole it. + +I looked at how another module did it. + +Implementing hooks is simply following patterns, it would be crazy not to copy. diff --git a/content/_index.md b/content/_index.md index 18cebc9..71622a9 100644 --- a/content/_index.md +++ b/content/_index.md @@ -112,6 +112,14 @@ function frankenstein_form_node_frankenstein_form_alter(&$form, \Drupal\Core\For } ``` +{{% note %}} +There we go, there's a module! I think we're done here. Anyone have any ideas for the next 40 minutes? + +.info files are not PHP. They cleverly indicate this by not starting with