Attaching files to body text in Drupal 8

But.. how you dare to write articles without attachments

This is going to be a short artivle, I have been toying with Ansible, and there are some things I want to share in this site, let it be for other people to read it or let it be as a future reference for myself, playbooks start being too long and uncomfortable to just copy and paste code and now I need to be able to attach files (in the future we will see how make site look best, changing templates and blocks). ¡I have more ideas than time!

To be able to fullfil our objective, we will use D8 Editor File Upload. No excess, just plainly what we need, we will do it with our friendly Drush.

Since we are mond-ordered people, let us do it part by part:

Put site in maintenance mode:

cd /var/www/drupal/
drush sset system.maintenance_mode 1
drush cr

Cowards do backups, unconcious people don't: (smart people have a backup policy)

tar -zcvf drupal.tar.gz /var/www/drupal/
pg_dump -U usuariobdd -b -f ficherodesalida.sql basedatosdrupal

We first update Drupal:

drush pm-update drupal
drush up

Then we install the module:

drush en editor_file

After that we set up the site into production mode:

drush sset system.maintenance_mode 0
drush cr

After that we have the module installed and enabled, now we need to go to filter management (admin/config/content/formats) and the we choose which editor format will be allowed to attach files, be careful to not leave this open for non-authenticated users or for authenticated users if you have autoboarding enabled, there are a lot of wolves around the forest.

We configure the editor mode of our choice and add the clip button to editor:

Personalizar el editor

And then we configure which file types are admitted, max sizes and the estile to be applied to the link.

Now it's time to test it:


¡And it works!