hook_future_alter()

94
hook_future_alte r() A preview of what’s planned for Drupal 8, and how you can help. DrupalCamp Toronto - Nov. 16, 2012

Upload: carter-vaughn

Post on 01-Jan-2016

75 views

Category:

Documents


0 download

DESCRIPTION

hook_future_alter(). A preview of what’s planned for Drupal 8, and how you can help. DrupalCamp Toronto - Nov. 16, 2012. About me. @webchick. Agenda. Drupal 8 timeline What’s planned for Drupal 8 for... End users and clients? Site builders? Designers and themers? Developers? - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: hook_future_alter()

hook_future_alter()A preview of what’s planned for Drupal 8, and how you can help.

DrupalCamp Toronto - Nov. 16, 2012

Page 2: hook_future_alter()

About me

@webchick

Page 3: hook_future_alter()

Agenda

•Drupal 8 timeline

•What’s planned for Drupal 8 for...

•End users and clients?

•Site builders?

•Designers and themers?

•Developers?

•How can YOU help?

Page 4: hook_future_alter()

WAT?

A Drupal 8 talk?! But I just started using Drupal 7!

Page 5: hook_future_alter()

Drupal 8 Timeline

Drupal Drupal 7.07.0

Jan 5, 2011

Development Development beginsbegins

Mar 10, 2011

Feature Feature freezefreeze

Dec 1, 2012

Drupal 8.0Drupal 8.0

Sep, 2013

Code Code freezefreeze

April 1, 2013

Page 6: hook_future_alter()

Drupal 8 Timeline

Drupal Drupal 7.07.0

Development Development beginsbegins

Jan 5, 2011

Mar 10, 2011

Dec 1, 2012

Code Code freezefreeze

April 1, 2013

Drupal 8.0Drupal 8.0

Sep, 2013

nownow

Nov, 2012

Feature Feature freezefreeze

Page 7: hook_future_alter()

Time to kick ass

with Drupal 8!

Page 8: hook_future_alter()

Disclaimer: This stuff is actively undergoing development. 100%

accuracy not guaranteed.

Page 9: hook_future_alter()

Remember: None of this

happens without

YOUR help!

Page 10: hook_future_alter()

Changes for end-

users and clients

Page 11: hook_future_alter()

Authoring experience

improvements

Issue tag: Usability

Page 12: hook_future_alter()

What problems are we trying to solve?

Page 13: hook_future_alter()

What problems are we trying to solve?

Page 14: hook_future_alter()

What problems are we trying to solve?

Page 15: hook_future_alter()

Spark

http://drupal.org/project/sparkIssue tag: Spark

Page 16: hook_future_alter()
Page 17: hook_future_alter()

Technical strength

Authoring experience

Page 18: hook_future_alter()

WYSIWYG in Core!

Page 19: hook_future_alter()

In-Place Editing

http://buytaert.net/spark-update-in-line-editing-in-drupal

Page 20: hook_future_alter()

Content creation page++http://drupal.org/node/1510532

Page 21: hook_future_alter()

Mobile

Issue tag: Mobile

Page 22: hook_future_alter()

MobileMobile25X growth 25X growth

over next 5 years!over next 5 years!

All Drupal sites

All CMS sites

All sites

Page 23: hook_future_alter()

What problems are we trying to solve?

Ooglay! :(

Page 24: hook_future_alter()

Responsive themes, images, and breakpoints

Page 25: hook_future_alter()

Mobile friendly admin

Page 27: hook_future_alter()

Changes for site builders

Page 28: hook_future_alter()

New directory structure

modules

themes

sites all

modules

themes

node

contrib_module

custom_theme

bartik

(Drupal 7)

Page 29: hook_future_alter()

New directory structure

modules

themes

core modules

contrib_module

custom_theme

(Drupal 8)

themes

node

bartik

So... the exact opposite of what you’re used to. ;)

The drop is always moving!

Page 30: hook_future_alter()

It’s like i18n in core, but betterIssue tag: D8MI

Multilingual

Page 31: hook_future_alter()

What’s the plan for Drupal 8?

Page 32: hook_future_alter()

What’s the plan for Drupal 8?

Page 33: hook_future_alter()

Multilingual first

Page 34: hook_future_alter()

Download translation

updates through UI(?)

Page 35: hook_future_alter()

Usability improvements

Page 36: hook_future_alter()

Translatable entities!

Page 37: hook_future_alter()

Translatable entities!

Page 38: hook_future_alter()

Blocks and Layouts

It’s like Panels in core, but betterIssue tag: “SCOTCH”

Page 39: hook_future_alter()

What problems are we trying to solve?• Inconsistency; some

stuff on page is blocks, others special theme variables, and then “content” area.

•Only one (bendy) layout.

• Layout built “inside out”; blocks lack context of overall page

• Blocks can’t be re-used in multiple instances

Page 40: hook_future_alter()

What’s the plan for Drupal 8?

• Layout built “outside in”; necessary context provided to blocks

• Everything on page is a block (or a layout, or a nested layout)

• Blocks rendered independently, supporting ESI caching

Page 41: hook_future_alter()

Layouts

title: Two columncategory: Columns: 2template: two-colstylesheets: - two-col.cssregions: first: label: Left side type: content second: label: Right side type: aside

two-col.yml

<div class="layout-display layout-two-col clearfix <?php print $attributes['class']; ?>"<?php print $attributes; ?>> <div class="layout-region layout-col-first"> <?php print $content['first']; ?> </div> <div class="layout-region layout-col-second"> <?php print $content['second']; ?> </div></div>

two-col.tpl.php

@media only screen and (min-width: 59em) { .layout-two-col .layout-region { float: left; /* LTR */ width: 50%; }}

two-col.css

Page 42: hook_future_alter()

UI(?)

Page 43: hook_future_alter()
Page 44: hook_future_alter()

Responsive Layout builder(?)

Page 45: hook_future_alter()

Mother bleeping Views in mother bleeping core!Issue tag: “VDC”

Page 46: hook_future_alter()

What problems are we trying to solve?

Drupal 7 Drupal 7 releasedreleased

January 2011

People start using People start using itit

July 2011

...

Surpasses Surpasses Drupal 6Drupal 6

February 2012

13 months!

Page 47: hook_future_alter()

What problems are we trying to solve?

Page 48: hook_future_alter()

It’s here! :D

Page 49: hook_future_alter()

...and more!

•>= PHP 5.3.5

•Cleaner modules page(?)

•Better Field UI (?)

•New fields: Link, Email, Entity Reference(?), Date(?)

•Profile (back) in core(?)

Page 50: hook_future_alter()

Project Browser: install modules direct from UI(?)

http://drupal.org/node/1841788

Page 51: hook_future_alter()

Changes for

designers and front-

end developers

Page 52: hook_future_alter()

Issue tag: HTML5

Page 53: hook_future_alter()

HTML5 Form Elements

$form['telephone'] = array( '#type' => 'tel', '#title' => t('Phone'), );

$form['website'] = array( '#type' => 'url', '#title' => t('Website'), );

$form['email'] = array( '#type' => 'email', '#title' => t('Email'), );

$form['tickets'] = array( '#type' => 'number', '#title' => t('Tickets required'), );

Page 54: hook_future_alter()

<!DOCTYPE html><html<?php print $html_attributes; ?>> <head> <?php print $head; ?> <?php if ($default_mobile_metatags): ?> <meta name="MobileOptimized" content="width" /> <meta name="HandheldFriendly" content="true" /> <meta name="viewport" content="width=device-width" /> <meta http-equiv="cleartype" content="on" /> <?php endif; ?> <title><?php print $head_title; ?></title> <?php print $styles; ?> <?php print $scripts; ?> </head> <body class="<?php print $classes; ?>" <?php print $body_attributes;?>> <div id="skip-link"> <a href="#main-content" class="element-invisible element-focusable"><?php print t('Skip to main content'); ?></a> </div> <?php print $page_top; ?> <?php print $page; ?> <?php print $page_bottom; ?> </body></html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" version="XHTML+RDFa 1.0" dir="<?php print $language->dir; ?>"<?php print $rdf_namespaces; ?>><head profile="<?php print $grddl_profile; ?>"> <?php print $head; ?> <title><?php print $head_title; ?></title> <?php print $styles; ?> <?php print $scripts; ?></head><body class="<?php print $classes; ?>" <?php print $attributes;?>> <div id="skip-link"> <a href="#main-content" class="element-invisible element-focusable"><?php print t('Skip to main content'); ?></a> </div> <?php print $page_top; ?> <?php print $page; ?> <?php print $page_bottom; ?></body></html>

Drupal 7 Drupal 8

Page 55: hook_future_alter()

Markup cleanup

Page 56: hook_future_alter()

Standard Components

http://jacine.github.com/drupal/demo/

Page 57: hook_future_alter()

Twig

http://symfony.com/doc/current/book/templating.html

{{ foo.bar }}(print this)

{% foo(bar) %}(do this logic)

{# foo bar #}(comment this)

<article id="node-{{ node.nid }}" class="{{ attributes.class }} clearfix"{{ attributes }}> {{ title_prefix }} {% if not page %} <h2{{ title_attributes }}> <a href="{{ node_url }}" rel="bookmark">{{ label }}</a> </h2> {% endif %} {{ title_suffix }} {% if display_submitted %} <footer> {{ user_picture }} <p class="submitted">{{ submitted }}</p> </footer> {% endif %} <div class="content"{{ content_attributes }}> {# We hide the comments and links now so that we can render them later. #} {% hide(content.comments) %} {% hide(content.links) %} {{ content }} </div> {{ content.links }} {{ content.comments }}</article>

node.twig

Page 58: hook_future_alter()

6 & 7

Page 59: hook_future_alter()

Changes for coders

01110111 01101001 01101100 01101100 00100000 01100011 01101111 01100100 01100101 00100000 01110000 01101000 01110000 00100000 01100110 01101111 01110010 00100000 01100110 01101111 01101111 01100100

Page 60: hook_future_alter()

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

Page 61: hook_future_alter()

New Class Autoloader

Drupal 7

modules exampleexample.test

<?php/** * @file * Tests for example.module. *//** * Test the example_bar() function. */class ExampleFooTest extends DrupalWebTestCase { public static function getInfo() { ... }}/** * Test the example_bar() function. */class ExampleBarTest extends DrupalWebTestCase { public static function getInfo() { ... }}...

name = Exampledescription = An example.core = 7.xfiles[] = example.test

modules exampleexample.info

“Drupalism”

Page 62: hook_future_alter()

New Class Autoloader (PSR-0)

modules example lib Drupal example Tests ExampleFooTest.php

ExampleBarTest.php

<?php/** * @file * Definition of Drupal\example\Tests\ExampleFooTest. */namespace Drupal\example\Tests;

use Drupal\Core\Database\Database;/** * Test the example_foo() function. */class ExampleFooTest extends DrupalWebTestCase { public static function getInfo() { ... }}

Drupal 8

“Proudly found elsewhere”

Page 63: hook_future_alter()

Web Services

It’s like Services module in core, only better.Issue tag: WSCCI

Page 64: hook_future_alter()

What problems are we trying to solve?

Page 65: hook_future_alter()

What problems are we trying to solve?

Page 66: hook_future_alter()
Page 67: hook_future_alter()

What’s the plan for Drupal 8?

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

Page 68: hook_future_alter()

hook_menu()--Symfony Routes+

+

<?phpfunction book_menu() {   $items['book/export/%/%'] = array(    'page callback' => 'book_export',     'page arguments' => array(2, 3),     'access arguments' => array('access printer-friendly version'),     'type' => MENU_CALLBACK,     'file' => 'book.pages.inc',  );    $items['node/%node/outline'] = array(    'title' => 'Outline',     'page callback' => 'book_outline',     'page arguments' => array(1),     'access callback' => '_book_outline_access',     'access arguments' => array(1),     'type' => MENU_LOCAL_TASK,     'weight' => 2,     'file' => 'book.pages.inc',  );...  return $items;}?>

Drupal 7:modules/book/book.module

book__export:  pattern: '/book/export/{type}/{nid}'  defaults:    _controller: '\Drupal\book\BookController::export'  requirements:    _permission: 'access printer-friendly version'

book__node_outline:  pattern: '/node/{node}/outline'  defaults:    _controller: '\Drupal\book\BookController::outline'  requirements:    _access: book_outline_access

Drupal 8:modules/book/book.routing.yml

Page 69: hook_future_alter()

REST module$ curl -i -H "Accept: application/ld+json" --cookie SESSxxx http://example.com/entity/node/1

HTTP/1.0 200 OK<snip>Content-Type: application/ld+json{"nid":"1","vid":"1","isDefaultRevision":"1","uuid":"bc37d058-8c45-484c-8e00-eae8da8f4d67","type":"article","langcode":"en","title":"Hello","uid":"1","status":"1","created":"1353018305","changed":"1353018458","comment":"2","promote":"1","sticky":"0","tnid":"0","translate":"0","revision_timestamp":"1353018305","revision_uid":"1","\u0000*\u0000entityType":"node","\u0000*\u0000enforceIsNew":null,"\u0000*\u0000newRevision":false,"log":"","body":{"en":[{"value":"This is in English. I live in Vancouver, BC.","summary":"","format":"filtered_html","safe_value":"<p>This is in English. I live in Vancouver, BC.<\/p>\n","safe_summary":""}],"fr":[{"value":"Cette est en fran\u00e7ais. J'habite \u00e1 Montr\u00e9al, PQ.","summary":"","format":"filtered_html","safe_value":"<p>Cette est en fran\u00e7ais. J'habite \u00e1 Montr\u00e9al, PQ.<\/p>\n","safe_summary":""}]},"field_tags":{"en":[{"tid":"2"},{"tid":"1"}],"fr":[{"tid":"3"},{"tid":"4"}]},"field_image":{"und":[{"fid":"2","alt":"","title":"","width":"500","height":"400"}]},"rdf_mapping":{"field_image":{"predicates":["og:image","rdfs:seeAlso"],"type":"rel"},"field_tags":{"predicates":["dc:subject"],"type":"rel"},"rdftype":["sioc:Item","foaf:Document"],"title":{"predicates":["dc:title"]},"created":{"predicates":["dc:date","dc:created"],"datatype":"xsd:dateTime","callback":"date_iso8601"},"changed":{"predicates":["dc:modified"],"datatype":"xsd:dateTime","callback":"date_iso8601"},"body":{"predicates":["content:encoded"]},"uid":{"predicates":["sioc:has_creator"],"type":"rel"},"name":{"predicates":["foaf:name"]},"comment_count":{"predicates":["sioc:num_replies"],"datatype":"xsd:integer"},"last_activity":{"predicates":["sioc:last_activity_date"],"datatype":"xsd:dateTime","callback":"date_iso8601"}},"source":{"en":"","fr":"en"},"retranslate":{"en":false,"fr":false},"cid":"0","last_comment_timestamp":"1353018305","last_comment_name":null,"last_comment_uid":"1","comment_count":"0","name":"root","picture":"0","data":"b:0;"}

Page 70: hook_future_alter()

Configuration Management

It’s like Features module in core, only better.Issue tag: Configuration system

node ID 4

node ID 4

Page 71: hook_future_alter()

What problems are we trying to solve?

Page 72: hook_future_alter()

What problems are we trying to solve?

Page 73: hook_future_alter()

What problems are we trying to solve?

variable_set()/variable_get()

ctools_export_object()/ctools_export_load_object()

db_select()/db_update()/db_delete()

$conf[...];hook_update_N()

drush fu

Page 74: hook_future_alter()

What’s the plan for Drupal 8?

http://heyrocker.com/how-use-drupal-8-configuration-system

ALERT!Important announcement about something.

ALERT!Important announcement about something.

node/4 node/4

Cache Cache

Active File Store

Staging File Store

Active File Store

Staging File Store

Page 75: hook_future_alter()

What’s the plan for Drupal 8?

http://heyrocker.com/how-use-drupal-8-configuration-system

ALERT!Important announcement about something.

ALERT!Important announcement about something.

Cache Cache

node/4 node/4

Active File Store

Active File Store

Staging File Store

Active File Store

Staging File Store

11

22

33

44

55

Page 76: hook_future_alter()

Screensht of UI with DiffScreensht of UI with Diff

Page 77: hook_future_alter()

Configuration API

$config = config(‘contact.settings’);$config->set(‘user_default_enabled’, 1);$config->save();

default_category: feedbackflood: limit: '5' interval: '3600'user_default_enabled: '1'

files/config_XXX/active/contact.settings.yml

Want to deploy it? Use config().

Page 78: hook_future_alter()

State API

state()->set('update.last_check', $now);...$last_check = state()->get('update.last_check') ?: 0;

Only useful for this environment? Use state().

MySQL [8x]> SELECT * FROM key_value WHERE collection = 'state' AND name = 'update.last_check';+------------+-------------------+---------------+| collection | name | value |+------------+-------------------+---------------+| state | update.last_check | i:1353017727; |+------------+-------------------+---------------+1 row in set (0.00 sec)

Page 79: hook_future_alter()

Other stuff

•Getting OOPy with it!

•Entity API++

•More fasterer testbot!

•File/Media API improvements

•...and more!

Page 80: hook_future_alter()

Gotta catch ‘em all!

http://drupal.org/list-changes

Page 81: hook_future_alter()

Huge round of applause to over 800

contributors!

Over 600 contributors so far!

Page 82: hook_future_alter()

Obligatory picture of scary clouds

and dire warnings.

Page 83: hook_future_alter()

Time to kick ass

with Drupal 8!

Page 84: hook_future_alter()

How to starthttp://drupal.org/core-mentoring-hours

http://drupal.org/core-windsprints

Tuesdays and Wednesdays in #drupalHand-holding for all of your newbie questions!Tasks for non-coders as well!

Fridays in #drupalWork on most important tasks for each initiative with really smart people. :)

Anytime, in #drupal-contribute!

Page 85: hook_future_alter()

Most important stuff at any given

time

http://drupal.org/community-initiatives/drupal-core

Page 86: hook_future_alter()

Thank you!Questions? :)

Page 87: hook_future_alter()

Slide Credits• Angela “webchick” Byron

• Kristof De Jaeger

• Jen Lampton

•Dries Buytaert

•Gábor Hojtsy

• Larry Garfield

• Jingsheng Wang (王景昇 )

Page 88: hook_future_alter()

Myth Busters

htt

p:/

/ww

w.fl

ickr

.com

/ph

oto

s/ky

lem

ay/

Page 89: hook_future_alter()

Fight the Einstein perception.

You must be this smart to contribute

to open source

Page 90: hook_future_alter()

What is a contributor?

that’s that’s dumb.dumb.

i want to i want to see it see it fixed.fixed.

i can do i can do something something about it.about it.

These people power open

source.

Page 91: hook_future_alter()

How improvements

are made

Amazing!

Wow!

Your best work yet!!

Gina the Genius

Page 92: hook_future_alter()

How improvements

are madeIssue queueBug reportBug report

Needs ReviewNeeds Review

Needs WorkNeeds Work

Reviewed & TestedReviewed & Tested

Edwina theEnd User

Paula theProgrammer

WTF?I’ll postfeedback.

Breaks in IE

6.

Hey, look! A

bug report!

I’ll try and fix

it.

Thanks!

Take 2!

Needs ReviewNeeds Review

Also, mind your

spelling.

Wendy the poor soulstuck on Windows XP

Needs WorkNeeds Work

Ok! Try this!

Needs ReviewNeeds Review

Wow!Much better!

Tatiana the Tester

Page 93: hook_future_alter()

We need more of us to participate!

* Actual percentage is much lower; I had to do unholy things to numbers to get even a sliver of

pie to show up.

Sample statistics from

Drupal project*

Page 94: hook_future_alter()

A summary of Drupal 8’s

aspirations, with cats.

So easy your cat can use it!(we hope...)