SlideShare a Scribd company logo
1 of 45
#D8CX
Kate Marshalkina & Konstantin Komelin
DrupalCamp Kyiv 2013 Start Here
Upgrade your modules
to Drupal 8
A Little More About Us
2
DrupalCamp Kyiv 2013
[Moscow, Russia]
• UI Cache Clear module author
• Contributor to several modules
• Web developer at Licel LLC
[Saint Petersburg, Russia]
• Author of Yandex.Metrics, Pinned Site
• Contributor to modules and themes
• Co-organizer of Drupal Community in St. Petersburg
• Individual web developer, trainer and consultant
Kate Marshalkina kalabro
Konstantin Komelin KKomelin
What is Drupal 8?
3
DrupalCamp Kyiv 2013
Drupal 8
≠
LOREM IPSUM DOLOREM COMPANY Insert You Tagline Here
Drupal 8 — Drupal,even better!
4
Mobilesupport&inlineediting
5
DrupalCamp Kyiv 2013
#D8CX: Drupal 8 Contrib Experience
• Release top 40 modules together with D8
• 27 modules with #D8CX flag (Jun 8, 2013)
• Not only top modules are important!
#D8CX: I pledge that UI Cache Clear will have a full Drupal 8 release on the day that
Drupal 8 is released.
#D8CX: We pledge that Yandex.Metrics will have a full Drupal 8 release on the day
that Drupal 8 is released.
#D8CX: I pledge that Yandex Services Authorization API will have a full Drupal 8
release on the day that Drupal 8 is released.
6
DrupalCamp Kyiv 2013
Why should I upgrade?
7
DrupalCamp Kyiv 2013
• Be one of the first
• Prepare to D8
• Learn Drupal 8 API
• Help to community and Drupal
• Just for fun ;)
When should I start?
8
DrupalCamp Kyiv 2013
“In Villabajo they are still drilling the core and don’t have agreements about
many things, and in Villarriba others have already upgraded modules”
D8 begins
Mar 10, 2011
Alpha1 RC
Dec, 2013
Beta
May 20, 2013
Drupal 8.0
Sep-Oct, 2013
July, 2013
Our examples>
DrupalCamp Kyiv 2013
Yandex.Metrics (8.x)
10
DrupalCamp Kyiv 2013
UI Cache Clear (7.x)
11
DrupalCamp Kyiv 2013
UI Cache Clear (8.x)
12
DrupalCamp Kyiv 2013
13
DrupalCamp Kyiv 2013
New home for sites/all/*
Drupal 7 Drupal 8
A new folder structure
Before you start
14
DrupalCamp Kyiv 2013
• Update PHP to 5.3.10
• Reconcile to o_OP
• Get used to use https://drupal.org/list-changes
• Be ready to reinstall Drupal
• Prepare your rocket ;)
Find 5 differences
15
DrupalCamp Kyiv 2013
Drupal 7 Drupal 8
name = 'Yandex.Metrics Counter'
core = 7.x
files[] = yandex_metrics.test
name: 'Yandex.Metrics Counter'
core: 8.x
type: module
yandex_metrics.info yandex_metrics.info.yml
16
Hurray!
We’ve just upgraded the module!
Thanks for coming!
Goodbye :-P
hook_menu and routing
17
DrupalCamp Kyiv 2013
function yandex_metrics_menu() {
$items['admin/config/system/yandex_metrics'] = array(
'title' => 'Yandex.Metrics',
'route_name' => 'yandex_metrics_counter_settings',
);
// ...
}
yandex_metrics.moduleStep 2
yandex_metrics_counter_settings:
pattern: '/admin/config/system/yandex_metrics'
defaults:
_form: 'Drupalyandex_metricsFormYandexMetricsCounterSettingsForm'
requirements:
_permission: 'administer Yandex.Metrics settings'
yandex_metrics.routing.ymlStep 1
Settings form
18
DrupalCamp Kyiv 2013
namespace Drupalyandex_metricsForm;
use DrupalsystemSystemConfigFormBase;
class YandexMetricsCounterSettingsForm extends SystemConfigFormBase {
public function getFormID() {
return 'yandex_metrics_counter_settings';
}
//...
lib/Drupal/yandex_metrics/Form/YandexMetricsCounterSettingsForm.php
— Goodbye, system_settings_form().
Settings form
19
DrupalCamp Kyiv 2013
public function buildForm(array $form, array &$form_state) {
$form['path'] = array(
'#type' => 'details',
'#title' => t('Page specific tracking settings'),
);
// ...
return parent::buildForm($form, $form_state);
}
public function validateForm(array &$form, array &$form_state) { }
public function submitForm(array &$form, array &$form_state) { }
lib/Drupal/yandex_metrics/Form/YandexMetricsCounterSettingsForm.php
Override methods that you need
Configuration & State
20
DrupalCamp Kyiv 2013
Variables (D7)
Configuration (D8)
State (D8)
Configuration files
21
DrupalCamp Kyiv 2013
yandex_metrics.settings:
type: mapping
label: 'Yandex.Metrics Counter settings'
mapping:
counter_code:
type: string
label: 'Counter code'
config/schema/yandex_merics.schema.yml
counter_code: ''
config/yandex_merics.settings.yml
Config & State
22
DrupalCamp Kyiv 2013
// Get config value.
$counter_code = Drupal::config('yandex_metrics.settings')
->get('counter_code');
// Set config value.
Drupal::config('yandex_metrics.settings')
->set('counter_code', $counter_code)->save();
In files
// Get value of state variable.
$value = Drupal::state()->get('some_module.key');
// Set value of state variable.
Drupal::state()->set('some_module.key', $value);
In database
Entities
23
DrupalCamp Kyiv 2013
Fieldable
EntityNG (DX)
Why: deployment, unification
Idea: ctools exportables
Implementation: plugins + yml
new
Content Entities Config Entities
Examples:
Nodes
Taxonomy terms
Users
Comments
Files
Menu Links
…
Examples:
Block instances
Vocabularies
User roles
Views
Menus
Display Modes
Image Styles
…
>
DrupalCamp Kyiv 2013
To be continued…
#D8CX
Kate Marshalkina & Konstantin Komelin
DrupalCamp Kyiv 2013 Continue Here
Upgrade your modules
to Drupal 8
Part 2
Drupal 8 Plugins
26
DrupalCamp Kyiv 2013
Why: extend them all!
Idea: ctools, next generation.
Implementation: classes, annotations.
Examples:
Blocks
Views
Entities
Field Widgets/Formatters
Text Filters
…
That’s not a
“Wordpress” plugin,
guys :)
Block Plugin (theoretical)
27
DrupalCamp Kyiv 2013
Block Plugin (practice)
28
LOREM IPSUM DOLOREM COMPANY Insert You Tagline Here
28
namespace Drupalhello_worldPluginBlock;
Now plugin will be found
automatically!
Block Plugin (practice)
29
DrupalCamp Kyiv 2013
Annotations instead of hook_*_info()
/**
* Provides a 'Random number' block.
*
* @Plugin(
* id = "hello_world_random_number",
* admin_label = @Translation("Random number"),
* module = "hello_world"
* )
*/
class HelloWorldRandomBlock extends BlockBase {
lib/Drupal/hello_world/Plugin/Block/HelloWorldRandomBlock.php
Block Plugin (practice)
30
DrupalCamp Kyiv 2013
Override methods that you need
protected function blockBuild() {
$this->configuration['label'] = t('Random number');
return array(
'#markup' => rand(1, 9),
);
}
//..
public function settings() { }
public function blockForm($form, &$form_state) { }
public function blockSubmit($form, &$form_state) { }
..lib/Drupal/hello_world/Plugin/Block/HelloWorldRandomBlock.php
Block Entities (theoretical)
31
DrupalCamp Kyiv 2013
block.block.bartik.search.yml
block.block.bartik.about_this_site.yml
block.block.bartik.random_number.yml
Block Entities (practice)
32
DrupalCamp Kyiv 2013
sites/default/files/config_#HASH#/active/block.block.bartik.random_number_1.yml
× 2
sites/default/files/config_#HASH#/active/block.block.bartik.random_number_2.yml
sites/default/files/config_#HASH#/active/block.block.bartik.random_number_3.yml
Hooks?
33
DrupalCamp Kyiv 2013
/**
* Implements hook_form_FORM_ID_alter().
*/
function ui_cache_clear_form_block_form_alter(&$form, $form_state)
{
$config_entity = $form_state['controller']->getEntity();
// Fieldset replaced by details.
$form['cache_details'] = array(
'#type' => 'details',
'#title' => t('Cache settings'),
);
// ..
• Hooks are still here.
• And there are new!
ui_cache_clear.module
>
DrupalCamp Kyiv 2013
Views
Visualization API (8.x)
35
DrupalCamp Kyiv 2013
https://drupal.org/sandbox/Niremizov/1985870
Thx Christophe Van Gysel!
Module features:
• Theme hook
• Plugin service (custom
chart handlers)
• Views Style Plugin
Views
36
DrupalCamp Kyiv 2013
• Inside core and already works
• Uses core Plugin System
• Export/Import using Config Entities
• Small API changes
CamelCase
hook_views_api, hook_views_plugin
Tip: How to create default view in Drupal 8:
Copy sitesdefaultfilesconfig_{HASH}activeconfigviews.view.{view_name}.yml
Paste modules{module_name}configviews.view.{view_name}.yml
Views Plugins
37
Drupal 7 Drupal 8
/**
* Implements hook_views_plugins().
*/
function vi..on_views_plugins() {
return array(
'style' => array(
'visualization' => array(
'title' =>
t('Visualization'),
'type' => 'normal',
'theme' => 'visualization',
// ...
'handler' =>
'visualization_plugin_style',
'uses options' => TRUE,
'uses grouping' => FALSE,
/*
* @Plugin(
* id = "visualization",
* title = @Translation("Visualization"),
* display_types = {"normal"}
* theme = "visualization",
* module = "visualization",
* )
*/
class Visualization
extends StylePluginBase {
protected $usesRowClass = TRUE;
protected $usesGrouping = FALSE;
protected $usesFields = TRUE;
// ...
}
DrupalCamp Kyiv 2013
PHPTemplate → Twig
38
DrupalCamp Kyiv 2013
{# core/modules/block/templates/block.html.twig #}
<div{{ attributes }}>
{{ title_prefix }}
{% if label %}
<h2{{ title_attributes }}>{{ label }}</h2>
{% endif %}
{{ title_suffix }}
<div{{ content_attributes }}>
{{ content }}
</div>
</div>
DrupalCamp Kyiv 2013
KEEP CALM
AND
CLEAR CACHE
And Drupal 8 says:
— “Fatal error: Call to undefined function cache_clear_all()”
Cache System
Cache Tags instead of wildcards
DrupalCamp Kyiv 2013
Cached Item 1
Tag 1
Tag 2
Tag 3
Cached Item 2 Tag 2 Cached Item 3
Tag 1
Tag 3
cache()->invalidateTags(array('Tag 2'));
Cached Item 3
Tag 1
Tag 3
Cached Item 1
Tag 1
Tag 2
Tag 3
Cached Item 2 Tag 2
*
Note: Drupal calculates “checksum” for every cache tag when read from cache!
40
Cache System
41
DrupalCamp Kyiv 2013
// Set cache to 'page' bin.
cache('page')->set($cid, $data, $expire, $tags);
New Cache API
// Truncate cache table.
cache()->deleteAll();
// Marks cache items from all bins with 'content' tag as invalid.
cache_invalidate_tags(array('content' => TRUE));
// Get multiple cache items.
cache('field')->getMultiple($cids);
// Get item even it is invalid.
cache()->get('field:user:1', TRUE);
Automated tests
42
DrupalCamp Kyiv 2013
namespace Drupalyandex_metricsTests;
use DrupalsimpletestWebTestBase;
class CounterTest extends WebTestBase {
public static $modules = array('yandex_metrics');
public static function getInfo() { }
public function setUp() {
parent::setUp();
}
public function tearDown() { }
lib/Drupal/yandex_metrics/Tests/CounterTest.php
Join #D8CX!
Upgrade your module to Drupal 8 or help others!+
DrupalCamp Kyiv 2013
References
44
DrupalCamp Kyiv 2013
• Change records for Drupal core
http://drupal.org/list-changes
• [May 22, 2013] Alex Bronstein (effulgentsia) - Upgrading your modules to
Drupal 8
http://portland2013.drupal.org/session/upgrading-your-modules-drupal-8
• [Feb 8, 2013] Angie Byron (webchick) - Step-by-step: Converting modules
from Drupal 7 to Drupal 8
http://webchick.net/node/118
• [Nov 4, 2012] Tim Plunkett (tim.plunkett) - D8CX: The Reckoning
http://2012.badcamp.net/program/sessions/d8cx-reckoning
!
DrupalCamp Kyiv 2013
Thank you for your attention!
Konstantin Komelin
@KKomelin
konstantin@komelin.com
Kate Marshalkina
@kalabro
marshalkina@licel.ru

More Related Content

What's hot

Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Angela Byron
 
Evolution of Drupal and the Drupal community
Evolution of Drupal and the Drupal communityEvolution of Drupal and the Drupal community
Evolution of Drupal and the Drupal communityAngela Byron
 
Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7Phase2
 
Convert modules from 6.x to 7.x
Convert modules from 6.x to 7.xConvert modules from 6.x to 7.x
Convert modules from 6.x to 7.xJoão Ventura
 
Drupal 6 to 7 migration guide
Drupal 6 to 7 migration guideDrupal 6 to 7 migration guide
Drupal 6 to 7 migration guideEbizon
 
History of Drupal: From Drop 1.0 to Drupal 8
History of Drupal: From Drop 1.0 to Drupal 8History of Drupal: From Drop 1.0 to Drupal 8
History of Drupal: From Drop 1.0 to Drupal 8Websolutions Agency
 
10 New Things You Can Do with Drupal 8 Out-of-the-Box
10 New Things You Can Do with Drupal 8 Out-of-the-Box10 New Things You Can Do with Drupal 8 Out-of-the-Box
10 New Things You Can Do with Drupal 8 Out-of-the-BoxSuzanne Dergacheva
 
Speedrun: Build a Website with Panels, Media, and More in 45 Minutes
Speedrun: Build a Website with Panels, Media, and More in 45 MinutesSpeedrun: Build a Website with Panels, Media, and More in 45 Minutes
Speedrun: Build a Website with Panels, Media, and More in 45 MinutesAcquia
 
Drupal migrations in 2018 - presentation at DrupalCon in Nashville
Drupal migrations in 2018 - presentation at DrupalCon in NashvilleDrupal migrations in 2018 - presentation at DrupalCon in Nashville
Drupal migrations in 2018 - presentation at DrupalCon in NashvilleIrina Zaks
 
Database Migrations with Gradle and Liquibase
Database Migrations with Gradle and LiquibaseDatabase Migrations with Gradle and Liquibase
Database Migrations with Gradle and LiquibaseDan Stine
 
Drupal 8 Configuration Management
Drupal 8 Configuration ManagementDrupal 8 Configuration Management
Drupal 8 Configuration ManagementExove
 
Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2Anil Sagar
 
Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7Phase2
 
Plain english guide to drupal 8 criticals
Plain english guide to drupal 8 criticalsPlain english guide to drupal 8 criticals
Plain english guide to drupal 8 criticalsAngela Byron
 
Upgrading your site from Drupal 6 to Drupal 7
Upgrading your site from Drupal 6 to Drupal 7Upgrading your site from Drupal 6 to Drupal 7
Upgrading your site from Drupal 6 to Drupal 7Andrew Martha
 
Drupal 7 vs. Drupal 8: A Contrast of Multilingual Support
Drupal 7 vs. Drupal 8: A Contrast of Multilingual SupportDrupal 7 vs. Drupal 8: A Contrast of Multilingual Support
Drupal 7 vs. Drupal 8: A Contrast of Multilingual SupportAcquia
 
Drupal 8 - A Brief Introduction
Drupal 8 - A Brief IntroductionDrupal 8 - A Brief Introduction
Drupal 8 - A Brief IntroductionJeff Geerling
 
Drush und Multisite: drush_multi
Drush und Multisite: drush_multiDrush und Multisite: drush_multi
Drush und Multisite: drush_multiFlorian Latzel
 

What's hot (20)

Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8
 
Evolution of Drupal and the Drupal community
Evolution of Drupal and the Drupal communityEvolution of Drupal and the Drupal community
Evolution of Drupal and the Drupal community
 
Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7
 
Convert modules from 6.x to 7.x
Convert modules from 6.x to 7.xConvert modules from 6.x to 7.x
Convert modules from 6.x to 7.x
 
Drupal 6 to 7 migration guide
Drupal 6 to 7 migration guideDrupal 6 to 7 migration guide
Drupal 6 to 7 migration guide
 
History of Drupal: From Drop 1.0 to Drupal 8
History of Drupal: From Drop 1.0 to Drupal 8History of Drupal: From Drop 1.0 to Drupal 8
History of Drupal: From Drop 1.0 to Drupal 8
 
10 New Things You Can Do with Drupal 8 Out-of-the-Box
10 New Things You Can Do with Drupal 8 Out-of-the-Box10 New Things You Can Do with Drupal 8 Out-of-the-Box
10 New Things You Can Do with Drupal 8 Out-of-the-Box
 
Speedrun: Build a Website with Panels, Media, and More in 45 Minutes
Speedrun: Build a Website with Panels, Media, and More in 45 MinutesSpeedrun: Build a Website with Panels, Media, and More in 45 Minutes
Speedrun: Build a Website with Panels, Media, and More in 45 Minutes
 
Drupal migrations in 2018 - presentation at DrupalCon in Nashville
Drupal migrations in 2018 - presentation at DrupalCon in NashvilleDrupal migrations in 2018 - presentation at DrupalCon in Nashville
Drupal migrations in 2018 - presentation at DrupalCon in Nashville
 
Database Migrations with Gradle and Liquibase
Database Migrations with Gradle and LiquibaseDatabase Migrations with Gradle and Liquibase
Database Migrations with Gradle and Liquibase
 
features+
features+features+
features+
 
Drupal 8 Configuration Management
Drupal 8 Configuration ManagementDrupal 8 Configuration Management
Drupal 8 Configuration Management
 
Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2
 
Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7
 
Plain english guide to drupal 8 criticals
Plain english guide to drupal 8 criticalsPlain english guide to drupal 8 criticals
Plain english guide to drupal 8 criticals
 
Upgrading your site from Drupal 6 to Drupal 7
Upgrading your site from Drupal 6 to Drupal 7Upgrading your site from Drupal 6 to Drupal 7
Upgrading your site from Drupal 6 to Drupal 7
 
Drupal 7 vs. Drupal 8: A Contrast of Multilingual Support
Drupal 7 vs. Drupal 8: A Contrast of Multilingual SupportDrupal 7 vs. Drupal 8: A Contrast of Multilingual Support
Drupal 7 vs. Drupal 8: A Contrast of Multilingual Support
 
Flyway
FlywayFlyway
Flyway
 
Drupal 8 - A Brief Introduction
Drupal 8 - A Brief IntroductionDrupal 8 - A Brief Introduction
Drupal 8 - A Brief Introduction
 
Drush und Multisite: drush_multi
Drush und Multisite: drush_multiDrush und Multisite: drush_multi
Drush und Multisite: drush_multi
 

Viewers also liked

Your first d8 module
Your first d8 moduleYour first d8 module
Your first d8 moduletedbow
 
Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)Hajas Tamás
 
Faster and Smarter Development with Drupal Console
Faster and Smarter Development with Drupal ConsoleFaster and Smarter Development with Drupal Console
Faster and Smarter Development with Drupal ConsoleFFW
 
Drupal 8 Configuration Management
Drupal 8 Configuration ManagementDrupal 8 Configuration Management
Drupal 8 Configuration ManagementPhilip Norton
 
A New Theme Layer for Drupal 8
A New Theme Layer for Drupal 8A New Theme Layer for Drupal 8
A New Theme Layer for Drupal 8nyccamp
 
Made with drupal 8
Made with drupal 8Made with drupal 8
Made with drupal 8Luc Bézier
 
How Drupal 8 Reaches Its Full Potential on Pantheon
How Drupal 8 Reaches Its Full Potential on PantheonHow Drupal 8 Reaches Its Full Potential on Pantheon
How Drupal 8 Reaches Its Full Potential on PantheonPantheon
 
Drupal 8 Sample Module
Drupal 8 Sample ModuleDrupal 8 Sample Module
Drupal 8 Sample Moduledrubb
 
Create rich web stories with Drupal 8 and paragraphs
Create rich web stories with Drupal 8 and paragraphsCreate rich web stories with Drupal 8 and paragraphs
Create rich web stories with Drupal 8 and paragraphsTassos Koutlas
 
Drupal 8 Vocabulary Lesson
Drupal 8 Vocabulary LessonDrupal 8 Vocabulary Lesson
Drupal 8 Vocabulary LessonMediacurrent
 
Getting started with Drupal 8
Getting started with Drupal 8Getting started with Drupal 8
Getting started with Drupal 8Hector Iribarne
 
Drupal 8, tricks and tips learned from the first 6 months
Drupal 8, tricks and tips learned from the first 6 monthsDrupal 8, tricks and tips learned from the first 6 months
Drupal 8, tricks and tips learned from the first 6 monthsIztok Smolic
 

Viewers also liked (13)

Your first d8 module
Your first d8 moduleYour first d8 module
Your first d8 module
 
Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)
 
Faster and Smarter Development with Drupal Console
Faster and Smarter Development with Drupal ConsoleFaster and Smarter Development with Drupal Console
Faster and Smarter Development with Drupal Console
 
Drupal 8 Configuration Management
Drupal 8 Configuration ManagementDrupal 8 Configuration Management
Drupal 8 Configuration Management
 
A New Theme Layer for Drupal 8
A New Theme Layer for Drupal 8A New Theme Layer for Drupal 8
A New Theme Layer for Drupal 8
 
Paragraphs at drupal 8.
Paragraphs at drupal 8.Paragraphs at drupal 8.
Paragraphs at drupal 8.
 
Made with drupal 8
Made with drupal 8Made with drupal 8
Made with drupal 8
 
How Drupal 8 Reaches Its Full Potential on Pantheon
How Drupal 8 Reaches Its Full Potential on PantheonHow Drupal 8 Reaches Its Full Potential on Pantheon
How Drupal 8 Reaches Its Full Potential on Pantheon
 
Drupal 8 Sample Module
Drupal 8 Sample ModuleDrupal 8 Sample Module
Drupal 8 Sample Module
 
Create rich web stories with Drupal 8 and paragraphs
Create rich web stories with Drupal 8 and paragraphsCreate rich web stories with Drupal 8 and paragraphs
Create rich web stories with Drupal 8 and paragraphs
 
Drupal 8 Vocabulary Lesson
Drupal 8 Vocabulary LessonDrupal 8 Vocabulary Lesson
Drupal 8 Vocabulary Lesson
 
Getting started with Drupal 8
Getting started with Drupal 8Getting started with Drupal 8
Getting started with Drupal 8
 
Drupal 8, tricks and tips learned from the first 6 months
Drupal 8, tricks and tips learned from the first 6 monthsDrupal 8, tricks and tips learned from the first 6 months
Drupal 8, tricks and tips learned from the first 6 months
 

Similar to #D8CX: Upgrade your modules to Drupal 8 (Part 1 and 2)

October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...Eric Sembrat
 
Drupal training-by-ruchiwebsolutions
Drupal training-by-ruchiwebsolutionsDrupal training-by-ruchiwebsolutions
Drupal training-by-ruchiwebsolutionsphp2ranjan
 
Building mobile applications with DrupalGap
Building mobile applications with DrupalGapBuilding mobile applications with DrupalGap
Building mobile applications with DrupalGapAlex S
 
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationIBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationDevelopment Seed
 
Drupal 8: What's new? Anton Shubkin
Drupal 8: What's new? Anton ShubkinDrupal 8: What's new? Anton Shubkin
Drupal 8: What's new? Anton ShubkinADCI Solutions
 
Drupal Recipes: Building Image Galleries with jQuery and Flickr
Drupal Recipes: Building Image Galleries with jQuery and FlickrDrupal Recipes: Building Image Galleries with jQuery and Flickr
Drupal Recipes: Building Image Galleries with jQuery and FlickrBen Shell
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practicesmanugoel2003
 
Building a Drupal Distribution using Features, Drush Make, Installation Profi...
Building a Drupal Distribution using Features, Drush Make, Installation Profi...Building a Drupal Distribution using Features, Drush Make, Installation Profi...
Building a Drupal Distribution using Features, Drush Make, Installation Profi...Ben Shell
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with FeaturesNuvole
 
Drupal distributions - how to build them
Drupal distributions - how to build themDrupal distributions - how to build them
Drupal distributions - how to build themDick Olsson
 
Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010Siva Epari
 
Drupal Module Development
Drupal Module DevelopmentDrupal Module Development
Drupal Module Developmentipsitamishra
 
Drupal 8 improvements for developer productivity php symfony and more
Drupal 8 improvements for developer productivity  php symfony and moreDrupal 8 improvements for developer productivity  php symfony and more
Drupal 8 improvements for developer productivity php symfony and moreAcquia
 
Making views - DrupalGov Canberra 2017
Making views - DrupalGov Canberra 2017Making views - DrupalGov Canberra 2017
Making views - DrupalGov Canberra 2017Donna Benjamin
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Anne Tomasevich
 
Getting Started with DrupalGap
Getting Started with DrupalGapGetting Started with DrupalGap
Getting Started with DrupalGapAlex S
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Drupalcon Paris
 

Similar to #D8CX: Upgrade your modules to Drupal 8 (Part 1 and 2) (20)

October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
 
Drupal training-by-ruchiwebsolutions
Drupal training-by-ruchiwebsolutionsDrupal training-by-ruchiwebsolutions
Drupal training-by-ruchiwebsolutions
 
Building mobile applications with DrupalGap
Building mobile applications with DrupalGapBuilding mobile applications with DrupalGap
Building mobile applications with DrupalGap
 
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationIBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
 
Drupal 8: What's new? Anton Shubkin
Drupal 8: What's new? Anton ShubkinDrupal 8: What's new? Anton Shubkin
Drupal 8: What's new? Anton Shubkin
 
D7 as D8
D7 as D8D7 as D8
D7 as D8
 
Drupal Recipes: Building Image Galleries with jQuery and Flickr
Drupal Recipes: Building Image Galleries with jQuery and FlickrDrupal Recipes: Building Image Galleries with jQuery and Flickr
Drupal Recipes: Building Image Galleries with jQuery and Flickr
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
Building a Drupal Distribution using Features, Drush Make, Installation Profi...
Building a Drupal Distribution using Features, Drush Make, Installation Profi...Building a Drupal Distribution using Features, Drush Make, Installation Profi...
Building a Drupal Distribution using Features, Drush Make, Installation Profi...
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
 
Drupal distributions - how to build them
Drupal distributions - how to build themDrupal distributions - how to build them
Drupal distributions - how to build them
 
Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010
 
Drupal Module Development
Drupal Module DevelopmentDrupal Module Development
Drupal Module Development
 
Drupal 8 improvements for developer productivity php symfony and more
Drupal 8 improvements for developer productivity  php symfony and moreDrupal 8 improvements for developer productivity  php symfony and more
Drupal 8 improvements for developer productivity php symfony and more
 
Overview Of Drupal
Overview Of DrupalOverview Of Drupal
Overview Of Drupal
 
Overview Of Drupal
Overview Of DrupalOverview Of Drupal
Overview Of Drupal
 
Making views - DrupalGov Canberra 2017
Making views - DrupalGov Canberra 2017Making views - DrupalGov Canberra 2017
Making views - DrupalGov Canberra 2017
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8
 
Getting Started with DrupalGap
Getting Started with DrupalGapGetting Started with DrupalGap
Getting Started with DrupalGap
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 

More from Konstantin Komelin

Vue.js - реактивный фронтенд фреймворк для людей
Vue.js - реактивный фронтенд фреймворк для людейVue.js - реактивный фронтенд фреймворк для людей
Vue.js - реактивный фронтенд фреймворк для людейKonstantin Komelin
 
Responsive Web Design & Drupal
Responsive Web Design & DrupalResponsive Web Design & Drupal
Responsive Web Design & DrupalKonstantin Komelin
 
Респонсила вашего сайта
Респонсила вашего сайтаРеспонсила вашего сайта
Респонсила вашего сайтаKonstantin Komelin
 
Drupal и мобильные устройства
Drupal и мобильные устройстваDrupal и мобильные устройства
Drupal и мобильные устройстваKonstantin Komelin
 
Свой проект на Drupal.org от идеи до первого релиза
Свой проект на Drupal.org от идеи до первого релизаСвой проект на Drupal.org от идеи до первого релиза
Свой проект на Drupal.org от идеи до первого релизаKonstantin Komelin
 

More from Konstantin Komelin (7)

Vue.js - реактивный фронтенд фреймворк для людей
Vue.js - реактивный фронтенд фреймворк для людейVue.js - реактивный фронтенд фреймворк для людей
Vue.js - реактивный фронтенд фреймворк для людей
 
Open Source == Money
Open Source == MoneyOpen Source == Money
Open Source == Money
 
Responsive Web Design & Drupal
Responsive Web Design & DrupalResponsive Web Design & Drupal
Responsive Web Design & Drupal
 
The Journey to Drupal World
The Journey to Drupal WorldThe Journey to Drupal World
The Journey to Drupal World
 
Респонсила вашего сайта
Респонсила вашего сайтаРеспонсила вашего сайта
Респонсила вашего сайта
 
Drupal и мобильные устройства
Drupal и мобильные устройстваDrupal и мобильные устройства
Drupal и мобильные устройства
 
Свой проект на Drupal.org от идеи до первого релиза
Свой проект на Drupal.org от идеи до первого релизаСвой проект на Drupal.org от идеи до первого релиза
Свой проект на Drupal.org от идеи до первого релиза
 

Recently uploaded

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

#D8CX: Upgrade your modules to Drupal 8 (Part 1 and 2)

  • 1. #D8CX Kate Marshalkina & Konstantin Komelin DrupalCamp Kyiv 2013 Start Here Upgrade your modules to Drupal 8
  • 2. A Little More About Us 2 DrupalCamp Kyiv 2013 [Moscow, Russia] • UI Cache Clear module author • Contributor to several modules • Web developer at Licel LLC [Saint Petersburg, Russia] • Author of Yandex.Metrics, Pinned Site • Contributor to modules and themes • Co-organizer of Drupal Community in St. Petersburg • Individual web developer, trainer and consultant Kate Marshalkina kalabro Konstantin Komelin KKomelin
  • 3. What is Drupal 8? 3 DrupalCamp Kyiv 2013 Drupal 8 ≠
  • 4. LOREM IPSUM DOLOREM COMPANY Insert You Tagline Here Drupal 8 — Drupal,even better! 4
  • 6. #D8CX: Drupal 8 Contrib Experience • Release top 40 modules together with D8 • 27 modules with #D8CX flag (Jun 8, 2013) • Not only top modules are important! #D8CX: I pledge that UI Cache Clear will have a full Drupal 8 release on the day that Drupal 8 is released. #D8CX: We pledge that Yandex.Metrics will have a full Drupal 8 release on the day that Drupal 8 is released. #D8CX: I pledge that Yandex Services Authorization API will have a full Drupal 8 release on the day that Drupal 8 is released. 6 DrupalCamp Kyiv 2013
  • 7. Why should I upgrade? 7 DrupalCamp Kyiv 2013 • Be one of the first • Prepare to D8 • Learn Drupal 8 API • Help to community and Drupal • Just for fun ;)
  • 8. When should I start? 8 DrupalCamp Kyiv 2013 “In Villabajo they are still drilling the core and don’t have agreements about many things, and in Villarriba others have already upgraded modules” D8 begins Mar 10, 2011 Alpha1 RC Dec, 2013 Beta May 20, 2013 Drupal 8.0 Sep-Oct, 2013 July, 2013
  • 11. UI Cache Clear (7.x) 11 DrupalCamp Kyiv 2013
  • 12. UI Cache Clear (8.x) 12 DrupalCamp Kyiv 2013
  • 13. 13 DrupalCamp Kyiv 2013 New home for sites/all/* Drupal 7 Drupal 8 A new folder structure
  • 14. Before you start 14 DrupalCamp Kyiv 2013 • Update PHP to 5.3.10 • Reconcile to o_OP • Get used to use https://drupal.org/list-changes • Be ready to reinstall Drupal • Prepare your rocket ;)
  • 15. Find 5 differences 15 DrupalCamp Kyiv 2013 Drupal 7 Drupal 8 name = 'Yandex.Metrics Counter' core = 7.x files[] = yandex_metrics.test name: 'Yandex.Metrics Counter' core: 8.x type: module yandex_metrics.info yandex_metrics.info.yml
  • 16. 16 Hurray! We’ve just upgraded the module! Thanks for coming! Goodbye :-P
  • 17. hook_menu and routing 17 DrupalCamp Kyiv 2013 function yandex_metrics_menu() { $items['admin/config/system/yandex_metrics'] = array( 'title' => 'Yandex.Metrics', 'route_name' => 'yandex_metrics_counter_settings', ); // ... } yandex_metrics.moduleStep 2 yandex_metrics_counter_settings: pattern: '/admin/config/system/yandex_metrics' defaults: _form: 'Drupalyandex_metricsFormYandexMetricsCounterSettingsForm' requirements: _permission: 'administer Yandex.Metrics settings' yandex_metrics.routing.ymlStep 1
  • 18. Settings form 18 DrupalCamp Kyiv 2013 namespace Drupalyandex_metricsForm; use DrupalsystemSystemConfigFormBase; class YandexMetricsCounterSettingsForm extends SystemConfigFormBase { public function getFormID() { return 'yandex_metrics_counter_settings'; } //... lib/Drupal/yandex_metrics/Form/YandexMetricsCounterSettingsForm.php — Goodbye, system_settings_form().
  • 19. Settings form 19 DrupalCamp Kyiv 2013 public function buildForm(array $form, array &$form_state) { $form['path'] = array( '#type' => 'details', '#title' => t('Page specific tracking settings'), ); // ... return parent::buildForm($form, $form_state); } public function validateForm(array &$form, array &$form_state) { } public function submitForm(array &$form, array &$form_state) { } lib/Drupal/yandex_metrics/Form/YandexMetricsCounterSettingsForm.php Override methods that you need
  • 20. Configuration & State 20 DrupalCamp Kyiv 2013 Variables (D7) Configuration (D8) State (D8)
  • 21. Configuration files 21 DrupalCamp Kyiv 2013 yandex_metrics.settings: type: mapping label: 'Yandex.Metrics Counter settings' mapping: counter_code: type: string label: 'Counter code' config/schema/yandex_merics.schema.yml counter_code: '' config/yandex_merics.settings.yml
  • 22. Config & State 22 DrupalCamp Kyiv 2013 // Get config value. $counter_code = Drupal::config('yandex_metrics.settings') ->get('counter_code'); // Set config value. Drupal::config('yandex_metrics.settings') ->set('counter_code', $counter_code)->save(); In files // Get value of state variable. $value = Drupal::state()->get('some_module.key'); // Set value of state variable. Drupal::state()->set('some_module.key', $value); In database
  • 23. Entities 23 DrupalCamp Kyiv 2013 Fieldable EntityNG (DX) Why: deployment, unification Idea: ctools exportables Implementation: plugins + yml new Content Entities Config Entities Examples: Nodes Taxonomy terms Users Comments Files Menu Links … Examples: Block instances Vocabularies User roles Views Menus Display Modes Image Styles …
  • 24. > DrupalCamp Kyiv 2013 To be continued…
  • 25. #D8CX Kate Marshalkina & Konstantin Komelin DrupalCamp Kyiv 2013 Continue Here Upgrade your modules to Drupal 8 Part 2
  • 26. Drupal 8 Plugins 26 DrupalCamp Kyiv 2013 Why: extend them all! Idea: ctools, next generation. Implementation: classes, annotations. Examples: Blocks Views Entities Field Widgets/Formatters Text Filters … That’s not a “Wordpress” plugin, guys :)
  • 28. Block Plugin (practice) 28 LOREM IPSUM DOLOREM COMPANY Insert You Tagline Here 28 namespace Drupalhello_worldPluginBlock; Now plugin will be found automatically!
  • 29. Block Plugin (practice) 29 DrupalCamp Kyiv 2013 Annotations instead of hook_*_info() /** * Provides a 'Random number' block. * * @Plugin( * id = "hello_world_random_number", * admin_label = @Translation("Random number"), * module = "hello_world" * ) */ class HelloWorldRandomBlock extends BlockBase { lib/Drupal/hello_world/Plugin/Block/HelloWorldRandomBlock.php
  • 30. Block Plugin (practice) 30 DrupalCamp Kyiv 2013 Override methods that you need protected function blockBuild() { $this->configuration['label'] = t('Random number'); return array( '#markup' => rand(1, 9), ); } //.. public function settings() { } public function blockForm($form, &$form_state) { } public function blockSubmit($form, &$form_state) { } ..lib/Drupal/hello_world/Plugin/Block/HelloWorldRandomBlock.php
  • 31. Block Entities (theoretical) 31 DrupalCamp Kyiv 2013 block.block.bartik.search.yml block.block.bartik.about_this_site.yml block.block.bartik.random_number.yml
  • 32. Block Entities (practice) 32 DrupalCamp Kyiv 2013 sites/default/files/config_#HASH#/active/block.block.bartik.random_number_1.yml × 2 sites/default/files/config_#HASH#/active/block.block.bartik.random_number_2.yml sites/default/files/config_#HASH#/active/block.block.bartik.random_number_3.yml
  • 33. Hooks? 33 DrupalCamp Kyiv 2013 /** * Implements hook_form_FORM_ID_alter(). */ function ui_cache_clear_form_block_form_alter(&$form, $form_state) { $config_entity = $form_state['controller']->getEntity(); // Fieldset replaced by details. $form['cache_details'] = array( '#type' => 'details', '#title' => t('Cache settings'), ); // .. • Hooks are still here. • And there are new! ui_cache_clear.module
  • 35. Visualization API (8.x) 35 DrupalCamp Kyiv 2013 https://drupal.org/sandbox/Niremizov/1985870 Thx Christophe Van Gysel! Module features: • Theme hook • Plugin service (custom chart handlers) • Views Style Plugin
  • 36. Views 36 DrupalCamp Kyiv 2013 • Inside core and already works • Uses core Plugin System • Export/Import using Config Entities • Small API changes CamelCase hook_views_api, hook_views_plugin Tip: How to create default view in Drupal 8: Copy sitesdefaultfilesconfig_{HASH}activeconfigviews.view.{view_name}.yml Paste modules{module_name}configviews.view.{view_name}.yml
  • 37. Views Plugins 37 Drupal 7 Drupal 8 /** * Implements hook_views_plugins(). */ function vi..on_views_plugins() { return array( 'style' => array( 'visualization' => array( 'title' => t('Visualization'), 'type' => 'normal', 'theme' => 'visualization', // ... 'handler' => 'visualization_plugin_style', 'uses options' => TRUE, 'uses grouping' => FALSE, /* * @Plugin( * id = "visualization", * title = @Translation("Visualization"), * display_types = {"normal"} * theme = "visualization", * module = "visualization", * ) */ class Visualization extends StylePluginBase { protected $usesRowClass = TRUE; protected $usesGrouping = FALSE; protected $usesFields = TRUE; // ... } DrupalCamp Kyiv 2013
  • 38. PHPTemplate → Twig 38 DrupalCamp Kyiv 2013 {# core/modules/block/templates/block.html.twig #} <div{{ attributes }}> {{ title_prefix }} {% if label %} <h2{{ title_attributes }}>{{ label }}</h2> {% endif %} {{ title_suffix }} <div{{ content_attributes }}> {{ content }} </div> </div>
  • 39. DrupalCamp Kyiv 2013 KEEP CALM AND CLEAR CACHE And Drupal 8 says: — “Fatal error: Call to undefined function cache_clear_all()”
  • 40. Cache System Cache Tags instead of wildcards DrupalCamp Kyiv 2013 Cached Item 1 Tag 1 Tag 2 Tag 3 Cached Item 2 Tag 2 Cached Item 3 Tag 1 Tag 3 cache()->invalidateTags(array('Tag 2')); Cached Item 3 Tag 1 Tag 3 Cached Item 1 Tag 1 Tag 2 Tag 3 Cached Item 2 Tag 2 * Note: Drupal calculates “checksum” for every cache tag when read from cache! 40
  • 41. Cache System 41 DrupalCamp Kyiv 2013 // Set cache to 'page' bin. cache('page')->set($cid, $data, $expire, $tags); New Cache API // Truncate cache table. cache()->deleteAll(); // Marks cache items from all bins with 'content' tag as invalid. cache_invalidate_tags(array('content' => TRUE)); // Get multiple cache items. cache('field')->getMultiple($cids); // Get item even it is invalid. cache()->get('field:user:1', TRUE);
  • 42. Automated tests 42 DrupalCamp Kyiv 2013 namespace Drupalyandex_metricsTests; use DrupalsimpletestWebTestBase; class CounterTest extends WebTestBase { public static $modules = array('yandex_metrics'); public static function getInfo() { } public function setUp() { parent::setUp(); } public function tearDown() { } lib/Drupal/yandex_metrics/Tests/CounterTest.php
  • 43. Join #D8CX! Upgrade your module to Drupal 8 or help others!+ DrupalCamp Kyiv 2013
  • 44. References 44 DrupalCamp Kyiv 2013 • Change records for Drupal core http://drupal.org/list-changes • [May 22, 2013] Alex Bronstein (effulgentsia) - Upgrading your modules to Drupal 8 http://portland2013.drupal.org/session/upgrading-your-modules-drupal-8 • [Feb 8, 2013] Angie Byron (webchick) - Step-by-step: Converting modules from Drupal 7 to Drupal 8 http://webchick.net/node/118 • [Nov 4, 2012] Tim Plunkett (tim.plunkett) - D8CX: The Reckoning http://2012.badcamp.net/program/sessions/d8cx-reckoning
  • 45. ! DrupalCamp Kyiv 2013 Thank you for your attention! Konstantin Komelin @KKomelin konstantin@komelin.com Kate Marshalkina @kalabro marshalkina@licel.ru