From dadc20295d82a2414de2493d0cb6bddfd2ee41f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Thu, 19 Mar 2020 14:19:39 -0400 Subject: [PATCH] Commit post / notes / David's module as it was day of presentation --- when-not-module-for-that/blog-post.md | 14 ++++++++++ .../copyright/copyright.info.yml | 4 +++ .../copyright/src/Plugin/Block/Copyright.php | 27 +++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 when-not-module-for-that/blog-post.md create mode 100755 when-not-module-for-that/copyright/copyright.info.yml create mode 100755 when-not-module-for-that/copyright/src/Plugin/Block/Copyright.php diff --git a/when-not-module-for-that/blog-post.md b/when-not-module-for-that/blog-post.md new file mode 100644 index 0000000..36c0920 --- /dev/null +++ b/when-not-module-for-that/blog-post.md @@ -0,0 +1,14 @@ +# When There's Not a Module for That + +We'll put the resources first, because that's what y'all came for. But i'll blather on for a long while after them about , because it's my blog post. + +## 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 . + +### Key hooks + +* [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 ) + +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 diff --git a/when-not-module-for-that/copyright/copyright.info.yml b/when-not-module-for-that/copyright/copyright.info.yml new file mode 100755 index 0000000..e622172 --- /dev/null +++ b/when-not-module-for-that/copyright/copyright.info.yml @@ -0,0 +1,4 @@ +name: "Project Copyright" +type: module +description: "Generate a block with the copyright leyend." +core: "8.x" diff --git a/when-not-module-for-that/copyright/src/Plugin/Block/Copyright.php b/when-not-module-for-that/copyright/src/Plugin/Block/Copyright.php new file mode 100755 index 0000000..c0bf2b0 --- /dev/null +++ b/when-not-module-for-that/copyright/src/Plugin/Block/Copyright.php @@ -0,0 +1,27 @@ + $this->t('Copyright © @year All rights reserved', ['@year' => date('Y')]), + ]; + } + +} +