hook_future_alter()
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 PresentationTRANSCRIPT
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?
•How can YOU help?
WAT?
A Drupal 8 talk?! But I just started using Drupal 7!
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
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
Time to kick ass
with Drupal 8!
Disclaimer: This stuff is actively undergoing development. 100%
accuracy not guaranteed.
Remember: None of this
happens without
YOUR help!
Changes for end-
users and clients
Authoring experience
improvements
Issue tag: Usability
What problems are we trying to solve?
What problems are we trying to solve?
What problems are we trying to solve?
Technical strength
Authoring experience
WYSIWYG in Core!
In-Place Editing
http://buytaert.net/spark-update-in-line-editing-in-drupal
Content creation page++http://drupal.org/node/1510532
Mobile
Issue tag: Mobile
MobileMobile25X growth 25X growth
over next 5 years!over next 5 years!
All Drupal sites
All CMS sites
All sites
What problems are we trying to solve?
Ooglay! :(
Responsive themes, images, and breakpoints
Mobile friendly admin
Front-end Performance++
Source: http://www.stevesouders.com/blog/2012/02/10/the-performance-golden-rule/
http://drupal.org/project/issues/search/drupal?issue_tags=frontend+performance
Changes for site builders
New directory structure
modules
themes
sites all
modules
themes
node
contrib_module
custom_theme
bartik
(Drupal 7)
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!
It’s like i18n in core, but betterIssue tag: D8MI
Multilingual
What’s the plan for Drupal 8?
What’s the plan for Drupal 8?
Multilingual first
Download translation
updates through UI(?)
Usability improvements
Translatable entities!
Translatable entities!
Blocks and Layouts
It’s like Panels in core, but betterIssue tag: “SCOTCH”
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
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
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
UI(?)
Responsive Layout builder(?)
Mother bleeping Views in mother bleeping core!Issue tag: “VDC”
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!
What problems are we trying to solve?
It’s here! :D
...and more!
•>= PHP 5.3.5
•Cleaner modules page(?)
•Better Field UI (?)
•New fields: Link, Email, Entity Reference(?), Date(?)
•Profile (back) in core(?)
Project Browser: install modules direct from UI(?)
http://drupal.org/node/1841788
Changes for
designers and front-
end developers
Issue tag: HTML5
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'), );
<!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
Markup cleanup
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
6 & 7
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
Warning: Things are about to get... geeky.
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”
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”
Web Services
It’s like Services module in core, only better.Issue tag: WSCCI
What problems are we trying to solve?
What problems are we trying to solve?
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
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
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;"}
Configuration Management
It’s like Features module in core, only better.Issue tag: Configuration system
node ID 4
node ID 4
What problems are we trying to solve?
What problems are we trying to solve?
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
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
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
Screensht of UI with DiffScreensht of UI with Diff
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().
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)
Other stuff
•Getting OOPy with it!
•Entity API++
•More fasterer testbot!
•File/Media API improvements
•...and more!
Huge round of applause to over 800
contributors!
Over 600 contributors so far!
Obligatory picture of scary clouds
and dire warnings.
Time to kick ass
with Drupal 8!
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!
Most important stuff at any given
time
http://drupal.org/community-initiatives/drupal-core
Thank you!Questions? :)
Slide Credits• Angela “webchick” Byron
• Kristof De Jaeger
• Jen Lampton
•Dries Buytaert
•Gábor Hojtsy
• Larry Garfield
• Jingsheng Wang (王景昇 )
Myth Busters
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/ky
lem
ay/
Fight the Einstein perception.
You must be this smart to contribute
to open source
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.
How improvements
are made
Amazing!
Wow!
Your best work yet!!
Gina the Genius
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
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*
A summary of Drupal 8’s
aspirations, with cats.
So easy your cat can use it!(we hope...)