The Top 8 Improvements Coming To Drupal 8

If you like this presentation – show it...

Slide 0

The Top 8 Improvements Coming To Drupal 8 Angie "webchick" Byron Nova Scotia Drupal Meetup July 28, 2014

Slide 1

About me @webchick

Slide 2

What are we doing here tonight? Go through top 8 changes for Drupal 8, in order of meekness. ;) Walk through some of the bigger API changes in D8 for module developers Talk about when D8 is coming and how you can help

Slide 3

1. Improved Authoring Experience

Slide 4

Drupal 7

Slide 5

Drupal 8

Slide 6

Drupal 7

Slide 7

Drupal 8

Slide 8

2. Mobile First

Slide 9

Drupal 7

Slide 10

Drupal 8

Slide 11

Drupal 8

Slide 12

3. Site Builder Improvements

Slide 13

Views in Core!

Slide 14

Better Blocks

Slide 15

New Field Types

Slide 16

4. Multilingual++

Slide 17

Drupal 8

Slide 18

Translatable Everything! Content Blocks Menus User Profiles Taxonomy Views Image styles Text formats Comments Feeds …and more! No contrib modules needed!

Slide 19

5. Configuration Management

Slide 20

One core system to solve this mess variable_set()/variable_get() ctools_export_object()/ctools_export_load_object() db_select()/db_update()/db_delete() $conf[...]; hook_update_N() drush fu

Slide 21

Slide 22

Slide 23

Slide 24

Deploy any of the following admin/config/foo settings "Configuration Entities" including: Views Content Types Image Styles Text Formats Taxonomy Vocabularies … … but NOT content (contrib): Nodes Users Comments Taxonomy Terms

Slide 25

6. Twig & HTML5

Slide 26

PHPTemplate is now Twig 7.x: page.tpl.php 8.x: page.html.twig <div id="page-wrapper"> <div id="page"> <div id="header"> <div class="section clearfix"> <?php if ($logo): ?> <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo"> <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" /> </a> <?php endif; ?> <div class="layout-container">   <header role="banner"> {% if logo %} <a href="{{ front_page }}" title="{{ 'Home'|t }}" rel="home"> <img src="{{ logo }}" alt="{{ 'Home'|t }}"/> </a> {% endif %} Friendlier syntax for designers Variables auto-escaped for better security Semantic, HTML5 markup http://twig.sensiolabs.org

Slide 27

HTML5 Forms

Slide 28

No more support for IE 6, 7, & 8

Slide 29

7. Web Services

Slide 30

Slide 31

8. Modern, OO Code

Slide 32

Warning: Things are about to get... geeky.

Slide 33

"Getting off the Island"

Slide 34

Modern PHP Best Practices PHP 5.4+ Classes/Interfaces Namespaces Traits Dependency Injection Most PSR-* standards

Slide 35

Powered by Symfony2 Tutorial: http://fabien.potencier.org/article/50/create-your-own-framework-on-top-of-the-symfony2-components-part-1

Slide 36

…and dozens of other external libraries

Slide 37

…and dozens of other libraries A peek under the hood

Slide 38

Modules now in /modules 7.x modules ?? sites Ў Ў all Ў modules ?? ?? ?? 8.x modules ?? sites Ў ?? ?? core Ў modules ?? ?? Profiles and themes: same deal.

Slide 39

YAML, YAML everywhere 7.x: example.info 8.x: example.info.yml name = Example description = "Example module" core = 7.x files[] = example.test config = admin/config/example dependencies[] = node name: Example type: module description: "Example module" core: 8.x config: admin.example dependencies: - node New required "type" property No more files[] (we'll get to that later) Paths now have machine names (we'll get to that later, too) Drupalism: Kinda-Sorta-INI-Like "Proudly Invented Elsewhere": YAML

Slide 40

Classes, classes everywhere sites/all/modules example Ў Ў example.test 7.x modules example Ў Ў 8.x src Ў ExampleForm.php ExampleInterface.php ExampleController.php … Pages, forms, blocks, etc. are now all object-oriented.

Slide 41

Defining a page: 7.x function example_menu() { $items['hello'] = array( 'title' => 'Hello world', 'page callback' => '_example_page', 'access callback' => 'user_access', 'access arguments' => 'access content', ); return $items; }   function _example_page() { return t('Hello world.'); } example.module Drupalism: "ArrayPIs" ;)

Slide 42

Defining a page: 8.x example.hello: path: '/hello' defaults: _content: '\Drupal\example\ExampleController::hello' requirements: _permission: 'access content' example.routing.yml example.links.menu.yml example.hello: title: 'Hello world' route_name: example.hello "Proudly Invented Elsewhere": - SF2 Routing Component - MVC pattern

Slide 43

Defining a page: 8.x <?php   namespace Drupal\example;   use Drupal\Core\Controller\ControllerBase;   /** * Returns responses for Example module routes. */ class ExampleController extends ControllerBase { public function hello() { return array('#markup' => $this->t('Hello world.')); } } src/ExampleController.php "Proudly Invented Elsewhere": - PSR-4 Class Autoloader - OO code

Slide 44

Defining a block: 7.x example.module <?php function example_block_info() { $blocks['example'] = array( 'info' => t('Example block'), ); return $blocks; } function example_block_view($delta = '') { $block = array(); switch ($delta) { case 'example': $block['subject'] = t('Example block'); $block['content'] = array( 'hello' => array( '#markup' => t('Hello world'), ), ); break; } return $block; } Drupalism: "Mystery Meat" APIs based on naming conventions

Slide 45

Defining a block: 8.x <?php namespace Drupal\example\Plugin\Block; use Drupal\block\BlockBase; /** * Provides the Example block. * * @Block( *  id = "example", *  admin_label = @Translation("Example block"), * category = @Translation("Example") * ) */ class ExampleBlock extends BlockBase { public function build() { return array('hello' => array( '#markup' => $this->t('Hello world.') )); } } src/Plugin/Block/ExampleBlock.php "Proudly Invented Elsewhere": - Annotations - APIs defined by Interfaces

Slide 46

Choose Your Own Data Adventure While you can do it, it's now considered unusual to store data directly in the database; choose one of the following: Content Entities: Use for 1000s+ of records; fieldable. Ex: Nodes, Users, Comments, Feeds, Terms Config Entities: Use for 10s of records; create in UI, deploy. Ex: Views, Text Formats, Image Styles, Vocabularies Config API: Use for 1s of records; things you want deployed. Ex: most admin/config/foo forms Settings API: Use for 1s of records; things specific to an environment; not deployed. Ex: timestamps, hashes, keys

Slide 47

Read more about it! Plaster these URLs to your face: https://api.drupal.org/api/drupal/8 https://www.drupal.org/documentation/developer/api

Slide 48

Every API change in Drupal 8 Plaster this URL to your cat's face: https://www.drupal.org/list-changes

Slide 49

Rocket fuel to get started Plaster this URL to your dog's face: https://www.drupal.org/project/drupalmoduleupgrader

Slide 50

8 sounds great! So where's it at, anyway?

Slide 51

Current Release Status There are ~100 “critical” issues left to solve that block release. Of these, ~5 are “beta blockers” that block the beta release. “Beta” marks the time at which module developers can start re-writing their code on top of Drupal 8. Without lots of modules being ready, Drupal 8 will not have a successful launch, so we are trying to get beta right. “WHEN IT’S READY” (~Q2 2015) https://groups.drupal.org/core/updates

Slide 52

When should I start using it? Module/Theme developer? Right now! Provide early API feedback while things can still be changed. Early Adopter? Start building test sites during beta/RC Be prepared to "BYOBF" (bring your own bug fixes) Late Adopter? 6+ months after Drupal 8.0.0 Wait for enough contrib modules to be ported

Slide 53

What about upgrades? No more upgrade path; now, migration path. Build out your Drupal 8 site as a new site, then migrate content, users, etc. over. Drupal 6 => Drupal 8 migrations already in! Drupal 7 => Drupal 8 migrations in progress. https://www.drupal.org/upgrade/migrate

Slide 54

What if I'm stuck on D7 for the foreseeable future?

Slide 55

How can I help? Start porting your modules/themes! Give "developer experience" feedback while we can still fix things Help us find/fix holes in documentation Build a practice site or two Test out the D6 => D8 migration path! Find/File bug reports (with patches if you can!) Help kill critical core issues! :D

Slide 56

Want the full scoop? https://www.drupal.org/drupal-8.0 https://www.acquia.com/tags/ultimate-guide-drupal-8

Slide 57

Thanks! :) Questions?