Drupal 8

What You Need to Know

 

 

 

December 14, 2013 — DrupalCamp Ohio

Wayne Eaker / @wayneeaker

Overview

  • Drupal 8 Development Process
  • What's New For:
    • End Users
    • Site Builders
    • Themers
    • Developers
  • State of Drupal 8 Development
  • How You Can Help

I'm Wayne Eaker

  • Independent Drupal developer, site builder, themer
  • Maintainer of Node Gallery, Menu Badges, several other modules
  • Teach online Drupal training classes at DrupalTutor.com

 

Drupal 8 Experience

  • Started working on route conversion patches at DrupalCon Portland sprints
  • Conversion of module update data fetching
  • Ported Menu Badges, Link Badges modules to D8 in September...re-ported them in December.

zengenuity on drupal.org

@wayneeaker on Twitter

Acknowledgements

This presentation combines information from presentations,
documentation, blog posts, IRC discussions by:

 

  • Angela Byron (webchick)
  • Larry Garfield (Crell)
  • Jess Myrbo (xjm)
  • Kris Vanderwater (EclipseGc)
  • Kristof De Jaeger (swentel)
  • Gábor Hojtsy (Gábor Hojtsy)
  • Matthew Tift (mtift)
  • Dries Buytaert (Dries)
  • Many, many others.

 

Extensive Footnotes and Links: http://wayneeaker.com/drupal8talk

Drupal 8 Development

 

Jan 2011: Drupal 7.0 Released
Mar 2011: Drupal 8 Development Begins

Drupal 8 Initiatives

  • Mobile
  • Configuration Management
  • HTML5
  • Layouts
  • Multilingual
  • Views in Core
  • Web Services

Unofficial Drupal 8 Initiatives

  • Twig
  • Spark: UI improvements
  • Many Others

2.5 Years Later

  • 1750+ contributors to Drupal 8
    (double that of Drupal 7)
  • Most changes of any Drupal release
  • Drupal 8 positions Drupal to be a content engine
    across multiple platforms (not just
    for websites anymore)

What's New?

End Users

Mobile: Responsive Design

Drupal 7

Drupal 8

Mobile: Responsive Design

Drupal 7

Drupal 8

Mobile: Responsive Design

Drupal 7

Drupal 8

WYSIWYG in Core

WYSIWYG in Core

Drupal 7

WYSIWYG in Core

Drupal 8

Inline editing

File Field Multiselect

Responsive Preview

Overlay Module: Retired

Replaced by "Back to Site" button

HTML5 Form Elements

  • URL
  • Email
  • Tel
  • Date
  • Color
  • Range
  • Number
  • Search

Tour Module

Site Builders

Directory structure

Where do downloaded modules and themes go?

Drupal 7

Drupal 8

Directory structure

WAT?! Isn't that exactly what we've trained people not to do for years?

Yes!

(sites/all/modules and sites/all/themes still work)

Configuration Management

In Drupal 7, we have some problems

  • Configuration lives in the database.
  • Deploying config changes from dev to staging & production is hard.
  • Inconsistent formats between modules. Some CTools exportable, some require Strongarm, etc.

Configuration Management

Drupal 7: Features Module

Configuration Management

Drupal 8

  • New config system
  • Stored in YAML files, not DB
  • Can be version controlled

 

Configuration Management

Don't hack your active config!!!

Blocks Are Entities

Blocks Are Entities

Blocks Are Entities

Multiple instances of the same block!!

Blocks Are Entities

Blocks are fieldable!

Blocks Are Entities

Blocks are revisionable!

Form Displays

Multilingual Improvements

Multilingual Improvements

No longer requires a bazillion modules to translate user UX and content

Views in Core!!

Views in Core!!

Other Drupal 8 Views Features

  • Views are exportable with the
    configuration management system
  • Responsive HTML Tables
  • Views Bulk Operations in core

Views in Core!!

System pages are views

Web Services

Web Services

Drupal 7

Drupal 8

Web Services for Entities

Web Services for Views

Web Services

Themers

Twig: A New Templating Engine

  • Symfony component
  • No PHP
  • Easier to read
  • No SQL queries
  • Templates in "templates" folder

Twig

Drupal 7: node.tpl.php

Twig

Drupal 8: node.html.twig

IE 9+ Required

IE 6, 7, and 8 are unsupported.

Front-End Libraries

Module Developers

Major Rewrite of Drupal

Drupal module developers should prepare for a substantial re-learning process for Drupal 8.

  • PHP 5.3
  • Object-oriented approach
  • Namespaces, PSR-0
  • Dependency injection
  • Annotations
  • Symfony components
  • YAML
  • Many familiar hooks deprecated / removed

PHP 5.3: OO PHP

Drupal 7

PHP 5.3: OO PHP

Drupal 8

PHP 5.3: OO PHP

Drupal 8

PHP 5.3: OO PHP

Drupal 8

Namespaces: PSR-0

Namespaces: PSR-0

  • Allow for autoload of classes
  • Symfony class autoloader
  • Goodbye module_load_include()
  • Folders, folders, folders!

 

BookController.php is in /core/modules/book/lib/Drupal/book/Controller

Module Files

Drupal 7

Drupal 8

Routing

Routing

  • Uses Symfony HTTP routing components
  • URL routes defined in YAML file
  • hook_menu() used only for visible menu items.
    Reference the routes from YAML file.
  • hook_menu() -> modulename.routing.yml + hook_menu()

Routing

Drupal 7

Routing

Drupal 8: book.routing.yml

Routing

Drupal 8: book.module

Dependency Injection

  • Replaceable services for dependencies
  • Keeps code decoupled
  • Services passed to objects by injection when object is created
  • Allows replacement of core subsystems with configuration
  • Makes it easier to test with mock objects or test multiple subsystem implementations.
  • Examples: database connector, configuration manager, translation service
  • Services define in modulename.services.yml

Dependency Injection

book.services.yml

Dependency Injection

BookManager.php

Annotations

Documentation: Now with more code

Annotations

Symfony Components

  • HttpFoundation and HttpKernel
  • Routing
  • EventDispatcher
  • DependencyInjection
  • ClassLoader
  • Yaml
  • Twig
  • Serializer

Other Non-Drupal Components

  • Composer: Dependency manager
  • Guzzle: HTTP Client
  • Assetic: Asset manager (CSS and JS aggregation)
  • PHPUnit: Testing
  • PSR/Log: Consistent logging from components and Drupal

Drupal 8: A Modern PHP App

By adopting coding standards from the non-Drupal
PHP community, we can integrate and contribute to their work
without having to re-invent everything to fit our Drupalisms.

A Game Plan For Devs

  • Start now looking at Drupal 8
  • Get familiar with OOP, if you're not
  • If you have modules, start porting them
    (realizing you may have redo this later)
  • Give feedback on DX to core devs
  • Mentor others

Drupal 8 Timeline

 

Jan 2011: Drupal 7.0 Released
Mar 2011: Drupal 8 Development Begins
Feb 2013: Feature Freeze
Jul 2013: API Freeze...not quite...

Drupal 8 Status

Drupal 8 Status

  • API not frozen, but slushy
  • Still lots of issues to fix
  • DX improvements underway
  • Refactoring ongoing
  • New Import API / Migrate in core

How Can You Help?

How to get started?

Drupal 8 Release Date

Jan 2011: Drupal 7.0 Released
Mar 2011: Drupal 8 Development Begins
Feb 2013: Feature Freeze
Jul 2013: API Freeze...not quite...
Early 2014: Beta Releases
Q1 2014?: RC1 Release
Release: When it's ready.

Drupal 8 Issue Queue

When Can You Use Drupal 8?

Simpler Sites

Pretty soon after release
(Views in core helps)

More Complex Sites

Will take some time for modules to be updated
9 - 12 months after release

Drupal 8: What You Need to Know
December 14, 2013 — DrupalCamp Ohio
Slides and Links: http://wayneeaker.com/drupal8talk

Wayne Eaker / @wayneeaker