Commit as it was when presented

... i totally clicked through some slides, especially In Other Words, to show live what should have been slides.
This commit is contained in:
benjamin melançon 2020-03-19 14:18:37 -04:00
parent c676755686
commit c69a0c292f
3 changed files with 75 additions and 1 deletions

View file

@ -342,13 +342,17 @@ Then put in your key words and search.
##### There's a module that *almost* does exactly what you want ##### There's a module that *almost* does exactly what you want
* Contribute a patch! * Contribute a patch!
* Port it to Drupal 8/9!
{{% note %}} {{% note %}}
Even if your patch is not accepted nor is there any way given to build on the module, you can fork the module— maintain your own copy. Even if your patch is not accepted nor is there any way given to build on the module, you can fork the module— maintain your own copy.
{{% /note %}} {{% /note %}}
---
[![David submitting issue with patch](images/david-filing-issue-with-patch.png)](https://www.drupal.org/project/comment_notify/issues/2850935)
--- ---
@ -393,6 +397,69 @@ The module does not exist.
{{% /note %}} {{% /note %}}
---
![image](images/copyright-block.png)
---
```yaml
name: "Project Copyright"
type: module
description: "Generate a block with the copyright leyend."
core: "8.x"
```
---
```php
<?php
namespace Drupal\copyright\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
* Provides a block with the copyright legend.
*
* @Block(
* id = "copyright_block",
* admin_label = @Translation("Copyright"),
* )
*/
class Copyright extends BlockBase {
/**
* @inheritDoc
*/
public function build() {
return [
'#markup' => $this->t('Copyright © @year All rights reserved', ['@year' => date('Y')]),
];
}
}
```
---
## 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 )
{{% 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 %}}
--- ---
@ -410,6 +477,13 @@ The module does not exist.
--- ---
* 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
---
* A module bringing in a PHP library and getting crazy (started with simple field formatter, can use this or another module to demo that) - https://drupal.org/project/inotherwords

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB