when-not-a-module-for-that/web/content/_index.md
2020-03-17 22:57:24 -04:00

105 lines
1.5 KiB
Markdown

+++
title = "When There's Not a Module For That"
outputs = ["Reveal"]
+++
# When There's Not a Module For That
###### mid.camp/6337
---
###### Presented by
**Benjamin Melançon** & **Mauricio Dinarte**
###### AKA
**mlncn** & **dinarcon**
---
<img alt="Agaric" src="images/agaric-logo-stacked.png" class="plain" />
**ask@agaric.coop**
---
> When building a Drupal site, “there’s a module for that” can be the sweetest words you can hear.
{{% note %}}
{{% /note %}}
---
![Regular node add form with Save button](images/create-frankenstein-unmodified.png)
{{% note %}}
Say you're creating a site where people can relive great literature that may have been inspired by a global pandemic.
{{% /note %}}
---
`frankenstein.info.yml`
```yaml
name: Frankenstein
type: module
description: "Rename save button for Frankenstein's content."
core: 8.x
```
&nbsp;
`frankenstein.module`
```php
<?php
function frankenstein_form_node_frankenstein_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
$form['actions']['submit']['#value'] = t('Re-animate!');
}
```
---
### Where to put these files
![Folder hierarchy of custom module in Drupal](images/frankenstein-location-in-ranger.png)
---
![Regular node add form with Save button](images/create-frankenstein-unmodified.png)
---
**Enable your module:**
`drush -y en frankenstein`
---
*That slide was the most important you're going to be shown.*
# Enable your module
---
![Regular node add form with Save button as reanimate](images/create-frankenstein-reanimate.png)
---