The Top 8 Improvements Coming To Drupal 8

Понравилась презентация – покажи это...

Слайд 0

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

Слайд 1

About me @webchick

Слайд 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

Слайд 3

1. Improved Authoring Experience

Слайд 4

Drupal 7

Слайд 5

Drupal 8

Слайд 6

Drupal 7

Слайд 7

Drupal 8

Слайд 8

2. Mobile First

Слайд 9

Drupal 7

Слайд 10

Drupal 8

Слайд 11

Drupal 8

Слайд 12

3. Site Builder Improvements

Слайд 13

Views in Core!

Слайд 14

Better Blocks

Слайд 15

New Field Types

Слайд 16

4. Multilingual++

Слайд 17

Drupal 8

Слайд 18

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

Слайд 19

5. Configuration Management

Слайд 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

Слайд 21

Слайд 22

Слайд 23

Слайд 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

Слайд 25

6. Twig & HTML5

Слайд 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

Слайд 27

HTML5 Forms

Слайд 28

No more support for IE 6, 7, & 8

Слайд 29

7. Web Services

Слайд 30

Слайд 31

8. Modern, OO Code

Слайд 32

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

Слайд 33

"Getting off the Island"

Слайд 34

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

Слайд 35

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

Слайд 36

…and dozens of other external libraries

Слайд 37

…and dozens of other libraries A peek under the hood

Слайд 38

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

Слайд 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

Слайд 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.

Слайд 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" ;)

Слайд 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

Слайд 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

Слайд 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

Слайд 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

Слайд 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

Слайд 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

Слайд 48

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

Слайд 49

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

Слайд 50

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

Слайд 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

Слайд 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

Слайд 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

Слайд 54

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

Слайд 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

Слайд 56

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

Слайд 57

Thanks! :) Questions?