Handy modules when building
and maintaining your site

Stew West
Fran García-Linares

About us

stew.west@amazeelabs.com

Stew West, Drupal web developer

https://twitter.com/stewwest

https://www.drupal.org/u/stewest

fran.garcia@amazeelabs.com

Fran García-Linares, Drupal web developer

fjgarlin@gmail.com

https://www.drupal.org/u/fjgarlin

Agenda (45min)

1

2

Intro (5 min)

Useful modules (30~35 min)

  • Helper modules
  • Site building modules
  • Theme specific modules
  • Other use cases

Wrap up / Q & A (5 min)

3

Intro

  • To code or not to code? Site building vs back-end vs front-end.

  • Over-simplification:

    • Back end = (mostly) coding

    • Front end = (mostly) coding

    • Site building = (mostly) clicking

      • This is really powerful

      • ​We'll focus mostly on this today.

 

  • What do you need when you're building your new site?

    • Time savers

    • Modules, modules, modules...

    • *Environments

 

  • What do you need when you're maintaining your site?

    • Bug fixing, (security) updates, extensions

    • Deployment?

    • *Environments

Environments

 

Depends on:

- Size of project

- Size of company

- Level of knowledge/skills of the team

 

Options:

- Production

- Development > production

- Local > development > production

- Local > development > staging > production

Helper modules

*Most of these modules have D7 and D8 versions.

Environment indicator

https://www.drupal.org/project/environment_indicator

 

  • Really useful once sites are in production.
  • Helps with human error (aka: changing production without wanting to!).
  • Create multiple (coloured) environments and navigate through them easily.
  • Multiple colouring options (more and less subtle).
  • Favicon support.
  • Configuration in settings.php or features*.

 

 

// Environment indicator.
$config['environment_indicator.indicator']['bg_color'] = '#02921d';
$config['environment_indicator.indicator']['fg_color'] = '#ffffff';
$config['environment_indicator.indicator']['name'] = 'Local';

Backup and Migrate

https://www.drupal.org/project/backup_migrate

 

  • Back up and restore your Drupal:
    • MySQL database
    • Code
    • Files
  • Migrate a site between environments.
  • Automatic scheduled backups.
  • Destinations:
    • Folder in server
    • Another DB
    • FTP
    • S3
    • Email

 

 

Stage file proxy

https://www.drupal.org/project/stage_file_proxy

 

  • Copy files folder to development / local environment
    • Not in version control
      • scp, rsync...
      • drush rsync...
      • SFTP (Filezilla)
    • What if +10GB files
  • Important to have a writable sites/default/files folder
  • Will download files from the specified server
  • One line in settings.php

 

 

$conf['stage_file_proxy_origin'] = "http://www.exped.com";

GDPR

https://www.drupal.org/project/gdpr

 

  • Go-to module to make sure the site is GDPR compliant 
    • Checklist of things to check
    • Submodules
      • gdpr dump
        • Configure sanitization (tables, columns)
        • Uses Faker
        • Dump sanitized version of the database

 

Other services / modules?:

 

 

Devel

https://www.drupal.org/project/devel

 

  • Helper functions for Drupal developers
  • Multiple submodules
  • UI features to help debug, run code...
    • Execute PHP code
    • Generate dummy content
    • Debug theme (templates, suggestions, variables...)
    • Switch users
    • Variable editor
    • Useful blocks to trigger common dev operations
  • drush commands available

 

 

Pretty print objects

dsm / kpr / kint

Emails!

https://www.drupal.org/project/devel (not a typo)

DevelMailLog

 

 

Make sure that emails are not sent when testing*:

  • Webform
  • Rules
  • Cron

Other:

 

$config['system.mail']['interface']['default'] = 'devel_mail_log';
$config['devel.settings']['debug_mail_directory'] = 'temporary://mail_log';
$config['devel.settings']['debug_mail_file_format'] = 'pattern-%to-%subject-%datetime.mail.txt';
/**
 * Implements hook_mail_alter().
 *
 * Don't send any mail in development.
 */
function custom_mail_alter(&$message) {
  if (getenv('ENVIRONMENT') !== 'production') {
    $message['send'] = FALSE;
  }
}

* I learnt this the hard way... nearly 1K emails went out!

Webprofiler

https://www.drupal.org/project/devel (not a typo)

 

  • See info in old separate project: https://www.drupal.org/project/webprofiler
  • Symfony component
  • Contextual info:
    • PHP config
    • Request info
    • Timeline
    • Database
    • Views
    • Forms
    • Extensions
    • Routing
    • Cache
    • Assets
    • Config
    • Events
    • State
    • ...

 

 

Features

https://www.drupal.org/project/features

 

  • Export configuration, functionality into code as a module
  • Wrap up functionality (content type, views, etc)
    • Easy to apply on other sites
    • Base distributions for your company
    • Easy to deploy code
  • Specially useful in D7, but also for D8
    • One of the biggest problems in D7- is site config in DB
  • UI + drush commands
  • Related Modules
    • Drupal 8
      • Configuration Development, Config Menu Link, Configuration Tools, Configuration Update Manager, Configuration Synchronizer
    • Drupal 7
      • Features Override, Strongarm, Features Extra

 

 

Configuration read only mode

https://www.drupal.org/project/config_readonly

 

 

 

 

Not to be confused with:

 

 

Administration menu

Module filter / permission filter

Coffee

https://www.drupal.org/project/coffee

 

  • It helps you to navigate through the Drupal admin faster.
  • Similar to MacOS spotlight search.
  • Navigate the admin UI from the keyboard.
  • Quick actions (:add).
  • Alt + D
  • Warning: you'll never ever remember where things are anymore.

 

 

Dropguard

https://www.drupal.org/project/dropguard

 

 

  • Service to automate Drupal updates
  • External service. Needs access to:
    • git
    • ssh
  • Customisable workflow
    • You can decided whether to merge or not
    • It can create branches or commit directly
    • Broken site is safer than an unsecure site
  • Integrations
    • Jira
    • Slack
    • Email

 

 

settings.php!!!

<?php
/**
 * @file
 * AmazeeIO Drupal 7 local development environment configuration file.
 *
 * This file will only be included on local development environemnts.
 */

$conf['googleanalytics_account'] = 'UA-XXXXXXXX-Y';
$conf['theme_debug'] = TRUE;

# caching and aggregation off
$conf['preprocess_css'] = FALSE;
$conf['preprocess_js'] = FALSE;
$conf['cache'] = 0;
$conf['cache_lifetime'] = 0;

# enable developer modules
$conf['devel_enable'] = TRUE;
$conf['devel_themer_enable'] = TRUE;
 
# display all error messages
$conf['error_level'] = 2;
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
 
# intercept emails using Devel
$conf['mail_system'] = array(
    'default-system' => 'DevelMailLog',
);

# other settings
$conf['stage_file_proxy_origin'] = "...";
$conf['mandrill_api_key'] = "testKeySoNoEmailsGoOut";
...
<?php

/**
 * @file
 * Local development override configuration feature.
 */

$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
$config['system.logging']['error_level'] = 'verbose';
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['rebuild_access'] = TRUE;
...

D7

D8

  • Pre-configure modules
  • Enable / disable options (caching, aggregation...)
  • ...

Site building modules

Rules

https://www.drupal.org/project/rules

 

  • Conditional actions based on events

  • It's a replacement for the trigger module in core

  • Allows functionality to be re-used via components

  • Import/export feature (integrates with features)
  • Integrates with token

 

  • Use cases
    • Build flexible content publishing workflows changes
    • Send customized mails to notify your users about something important
    • Build an eCommerce store using Drupal Commerce

 

Help needed for D8 stable version: http://d8rules.org/

Paragraphs, bricks, field group, field collection

https://www.drupal.org/project/paragraphs

https://www.drupal.org/project/bricks

https://www.drupal.org/project/field_group

https://www.drupal.org/project/field_collection

  • Paragraphs is the new way of content creation!
    It allows you — Site Builders — to make things cleaner so that you can give more editing power to your end-users.
  • Bricks — is a new way of building pages on top of Entity Reference, Display Modes, Layout API, tabledrag.js and Flat Tables. Everything is in Drupal core that makes Bricks ultra-lightweight and developer-friendly.
  • ...

Organise fields and create layouts instead of having everything created via CKEditor... see next slide :-)

 

Sessions this week:

https://www.drupaleurope.org/session-by-expertise/paragraphs

 

 

CKeditor

Webform

https://www.drupal.org/project/webform

 

  • Create forms and surveys via Drupal UI
  • Stored results (analysis)
  • Export results (CSV)
  • After submission you can send emails
  • Extensive API

 

 

Theme specific

Bootstrap

https://www.drupal.org/project/bootstrap

 

  • Drupal meets Bootstrap Framework.

  • CDN support
    • Bootswatch support
  • Glyphicons support
  • Template / preprocess overrides for most of the components
  • Good base theme

 

 

Omega

https://www.drupal.org/project/omega

 

  • Great base theme
  • Great documentation
  • Subtheme generator
  • Full control of the code
  • +1 million downloads

 

 

Other use cases

Multilingual

https://www.drupal.org/project/entity_translation

  • In core for D8
  • One node, multiple translations

 

https://www.drupal.org/project/tmgmt

  • It does not make i18n or any other language module obsolete. It only facilitates the translation process.

  • Export and import via xliff and HTML (translation services)
  • Local Translator (Allows users to translate jobs)

 

 

Multiple domains

https://www.drupal.org/project/domain

  • Running several sites from one installation

  • Single shared database

  • Share users, content, and configurations

 

Decoupled approach!?

API-first initiative

 

 

API

Workspace

 

https://www.drupal.org/project/workspace

 

Like "git" for content :-)

 

"A workspace is an isolated collection of content revisions on your site"

  • Create and edit workspaces
  • Switch between workspaces
  • View the revision tree of an entity

 

Use case:

Preparing a whole section (one single push)

 

Needs other modules to push content between workspaces.

  • Deploy UI for deploying content between workspaces
  • Workbench Moderation replicate content from moderated workspaces to it's upstream workspace.
  • ...

 

 

Commerce

https://www.drupal.org/project/commerce

 

  • Commerce Kickstart Drupal distribution

  • eCommerce websites and applications

  • Leveraging Views and Rule

  • No hard-coded assumptions about your business model

  • Create product types with custom attributes

  • Dynamic product displays

  • Order management, line item

  • Payment method API

  • Tax calculation / VAT support

  • Discount pricing rules

 

 

Wrap up

  • That was some list! But you're missing...

  • Instead of this you could use that...

  • There is a module for (almost) everything

Q & A

https://slides.com/fjgarlin

We are

HIRING

Handy modules when building and maintaining your site // DrupalEurope 2018

By Fran García-Linares

Handy modules when building and maintaining your site // DrupalEurope 2018

  • 2,599