SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
Drupal 7 vs 8
Andy Postnikov
Freelancer

&

Alexey Gaydabura
Lead Developer at @SkillD

Lviv, 2013

http://www.skilld.fr
Installer makeup
Drupal 7 - install.php
if (version_compare(PHP_VERSION, '5.2.4') < 0) {
exit;
}

Drupal 8 - install.php
chdir('..');
require_once __DIR__ . '/vendor/autoload.php';
if (version_compare(PHP_VERSION, '5.3.10') < 0) {
exit;
}
if (ini_get('safe_mode')) {
print 'Your PHP installation has safe_mode enabled.
...';
exit;
}
Drupal 7 - index.php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
menu_execute_active_handler();

Drupal 8 - index.php
require_once __DIR__ . '/core/vendor/autoload.php';
require_once __DIR__ . '/core/includes/bootstrap.inc';
try {
drupal_handle_request();
}
catch (Exception $e) {
print 'If you have ... read http://drupal.org/documentation/rebuild';

throw $e;
}
Drupal 7 - Bootstrap
1. DRUPAL_BOOTSTRAP_CONFIGURATION
2. DRUPAL_BOOTSTRAP_PAGE_CACHE
3. DRUPAL_BOOTSTRAP_DATABASE
4. DRUPAL_BOOTSTRAP_VARIABLES
5. DRUPAL_BOOTSTRAP_SESSION
6. DRUPAL_BOOTSTRAP_PAGE_HEADER
7. DRUPAL_BOOTSTRAP_LANGUAGE
8. DRUPAL_BOOTSTRAP_FULL
Drupal 8 - Bootstrap
1. DRUPAL_BOOTSTRAP_CONFIGURATION
+ DRUPAL_BOOTSTRAP_KERNEL
2. DRUPAL_BOOTSTRAP_PAGE_CACHE
3. DRUPAL_BOOTSTRAP_DATABASE
DRUPAL_BOOTSTRAP_VARIABLES
- DRUPAL_BOOTSTRAP_SESSION
- DRUPAL_BOOTSTRAP_PAGE_HEADER
- DRUPAL_BOOTSTRAP_LANGUAGE

+ DRUPAL_BOOTSTRAP_CODE
DRUPAL_BOOTSTRAP_FULL (language + theme)

Should be 3 steps - https://drupal.org/node/2023495
Drupal 7: Menu page callback
$result = _menu_site_is_offline()

? MENU_SITE_OFFLINE :

MENU_SITE_ONLINE;

drupal_alter('menu_site_status', $result, ...);
$result = call_user_func_array( $router['page_callback'],
$router['page_arguments']);
drupal_alter('page_delivery_callback',
$delivery_callback);
drupal_deliver_html_page()
drupal_render_page() - hook_page_build() + hook_page()
drupal_page_footer()
Drupal 8: Symfony drupal_handle_request()
// Initialize the environment, load settings.php, and activate a PSR-0 class
// autoloader with required namespaces registered.

drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
$kernel = new DrupalKernel('prod', drupal_classloader(),
!$test_only);
// @todo Remove this once everything in the bootstrap has been
//

converted to services in the DIC.

$kernel->boot();
drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
// Create a request object from the HttpFoundation.

$request = Request::createFromGlobals();
$response = $kernel->handle($request)
->prepare($request)->send();
$kernel->terminate($request, $response);
D7: Hook, alter, preprocess!
●
●
●
●
●

Core hooks
Custom hooks
Alter everything
Preprocess anything
Theme suggestions

You are the King!
D8: Hook, alter, preprocess!
+ Subscribe
●
●
●
●
●
●

Kernel & Routing events
Core hooks
Custom hooks
Alter everything
Preprocess anything
Theme suggestions ++

You are the King!
D8: Subscribe kernel
namespace SymfonyComponentHttpKernel;
final class KernelEvents

●
●
●
●
●
●

REQUEST - hook_boot()
CONTROLLER - menu “page callback”
VIEW - hook_page_build()
RESPONSE - hook_page_alter()
TERMINATE - hook_exit()
EXCEPTION
D8: Subscribe routing
namespace DrupalCoreRouting;
final class RoutingEvents {
const ALTER = 'routing.route_alter';
const DYNAMIC = 'routing.route_dynamic';
}
D8: Subscribe and alter
namespace DrupalCoreEventSubscriber;
class AccessSubscriber implements EventSubscriberInterface {

static function getSubscribedEvents() {
$events[KernelEvents::REQUEST][] = array
('onKernelRequestAccessCheck', 30);
// Setting very low priority to ensure access checks are run after alters.

$events[RoutingEvents::ALTER][] = array
('onRoutingRouteAlterSetAccessCheck', -50);
return $events;
}
}
D8: Subscribe
D8: Hook, alter, preprocess
function telephone_field_info_alter(&$info) {
if (Drupal::moduleHandler()->moduleExists('text')) {
$info['telephone']['default_formatter'] = 'text_plain';
}
}
function telephone_field_formatter_info_alter(&$info) {
if (isset($info['text_plain'])) {
$info['text_plain']['field_types'][] = 'telephone';
}
}
D7: My.module vs altering
●

hook_menu()

$items['mypath'] = array(
'page callback' => 'mypath_page_view'
'theme callback' => 'theme_mypath_page_view'
'delivery callback' => 'deliver_mypath_page_view'
●
●

hook_theme()
mypath_page_view($arg);

VS
●
●
●
●

hook_menu_alter()
hook_theme_registry_alter()
mycore_page_view()
mycore_page_theme()
D7: My.module hook_menu()
1.
2.
3.
4.
5.
6.

Routing
Menu links
Local actions
Local tasks
Breadcrumbs
Contextual links
D8: My.module NO hook_menu()
1.

my.routing.yml

2.

my_default_menu_links()

3.

my.local_actions.yml

4.

my.local_tasks.yml

5.

class MyBreadcrumbBuilder

6.

my.contextual_links.yml

7.

my.services.yml
D8: My.module vs altering
hook_”world”_alter() - THE SAME!
class MyEventSubscriber implements

EventSubscriberInterface
{ public static function getSubscribedEvents(); }

class MyServiceProvider implements

ServiceProviderInterface, ServiceModifierInterface
{
public function register(ContainerBuilder $container) {}
public function alter(ContainerBuilder $container) {}

}
D8: Services & Managers
D7 vs D8: render
Render array (‘#theme’ => ‘item_list’,‘#items’ => array())

https://drupal.org/node/2068471
+

$events[KernelEvents::VIEW][] = array('onHtmlFragment', 100);

+

$events[KernelEvents::VIEW][] = array('onHtmlPage', 50);

class Link extends HeadElement
class Metatag extends HeadElement
class HeadElement
class HtmlPage extends HtmlFragment
class HtmlFragment
When it’s ready™?
https://drupal.org/node/2107085
http://xjm.drupalgardens.com/blog/when-its-ready
no more hook_menu()
no more variable_get()
complete language negotiation
complete entity field api
Questions?
Drupal 7 vs 8
Anderey Postnikov

Alexey Gaydabura

Freelance Developer
Skype: andypost
E-mail: apostnikov@gmail.com

Lead Developer at @SkillD
Skype: alexey.gaydabura
E-mail: gaydabura@gmail.com

http://www.skilld.fr

Weitere ähnliche Inhalte

Was ist angesagt?

You must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular LibraryYou must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular LibraryBo-Yi Wu
 
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...탑크리에듀(구로디지털단지역3번출구 2분거리)
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkDance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkMichael Peacock
 
Codeigniter4の比較と検証
Codeigniter4の比較と検証Codeigniter4の比較と検証
Codeigniter4の比較と検証ME iBotch
 
Laravel Design Patterns
Laravel Design PatternsLaravel Design Patterns
Laravel Design PatternsBobby Bouwmann
 
How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?Tomasz Bak
 
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rulesSrijan Technologies
 
Conexcion java mysql
Conexcion java mysqlConexcion java mysql
Conexcion java mysqljbersosa
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationAbdul Malik Ikhsan
 
Filling the flask
Filling the flaskFilling the flask
Filling the flaskJason Myers
 
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?Srijan Technologies
 
#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...
#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...
#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...탑크리에듀(구로디지털단지역3번출구 2분거리)
 
OSGi framework overview
OSGi framework overviewOSGi framework overview
OSGi framework overviewBalduran Chang
 
Optimizing mysql stored routines uc2010
Optimizing mysql stored routines uc2010Optimizing mysql stored routines uc2010
Optimizing mysql stored routines uc2010Roland Bouman
 
Zagreb workshop
Zagreb workshopZagreb workshop
Zagreb workshopLynn Root
 
Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockCaldera Labs
 
What happens in laravel 4 bootstraping
What happens in laravel 4 bootstrapingWhat happens in laravel 4 bootstraping
What happens in laravel 4 bootstrapingJace Ju
 

Was ist angesagt? (20)

You must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular LibraryYou must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular Library
 
CodeIgniter 3.0
CodeIgniter 3.0CodeIgniter 3.0
CodeIgniter 3.0
 
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkDance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech Talk
 
Codeigniter4の比較と検証
Codeigniter4の比較と検証Codeigniter4の比較と検証
Codeigniter4の比較と検証
 
Laravel Design Patterns
Laravel Design PatternsLaravel Design Patterns
Laravel Design Patterns
 
How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?
 
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
 
Conexcion java mysql
Conexcion java mysqlConexcion java mysql
Conexcion java mysql
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept Implementation
 
Filling the flask
Filling the flaskFilling the flask
Filling the flask
 
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
 
#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...
#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...
#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...
 
Algotitmo Moinho
Algotitmo MoinhoAlgotitmo Moinho
Algotitmo Moinho
 
OSGi framework overview
OSGi framework overviewOSGi framework overview
OSGi framework overview
 
Zend framework
Zend frameworkZend framework
Zend framework
 
Optimizing mysql stored routines uc2010
Optimizing mysql stored routines uc2010Optimizing mysql stored routines uc2010
Optimizing mysql stored routines uc2010
 
Zagreb workshop
Zagreb workshopZagreb workshop
Zagreb workshop
 
Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh Pollock
 
What happens in laravel 4 bootstraping
What happens in laravel 4 bootstrapingWhat happens in laravel 4 bootstraping
What happens in laravel 4 bootstraping
 

Ähnlich wie Andy Postnikov - Drupal 7 vs Drupal 8: от бутстрапа до рендера

Lviv 2013 d7 vs d8
Lviv 2013 d7 vs d8Lviv 2013 d7 vs d8
Lviv 2013 d7 vs d8Skilld
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenchesLukas Smith
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5Darren Craig
 
Zend Framework 2 - Basic Components
Zend Framework 2  - Basic ComponentsZend Framework 2  - Basic Components
Zend Framework 2 - Basic ComponentsMateusz Tymek
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207patter
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
Drupalcon 2023 - How Drupal builds your pages.pdf
Drupalcon 2023 - How Drupal builds your pages.pdfDrupalcon 2023 - How Drupal builds your pages.pdf
Drupalcon 2023 - How Drupal builds your pages.pdfLuca Lusso
 
2023 - Drupalcon - How Drupal builds your pages
2023 - Drupalcon - How Drupal builds your pages2023 - Drupalcon - How Drupal builds your pages
2023 - Drupalcon - How Drupal builds your pagessparkfabrik
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)arcware
 
Patterns Are Good For Managers
Patterns Are Good For ManagersPatterns Are Good For Managers
Patterns Are Good For ManagersAgileThought
 
Magento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowMagento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowVrann Tulika
 
Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8Acquia
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
Debugging in drupal 8
Debugging in drupal 8Debugging in drupal 8
Debugging in drupal 8Allie Jones
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & ToolsIan Barber
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionPhilip Norton
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best PracticesYekmer Simsek
 

Ähnlich wie Andy Postnikov - Drupal 7 vs Drupal 8: от бутстрапа до рендера (20)

Lviv 2013 d7 vs d8
Lviv 2013 d7 vs d8Lviv 2013 d7 vs d8
Lviv 2013 d7 vs d8
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenches
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
Zend Framework 2 - Basic Components
Zend Framework 2  - Basic ComponentsZend Framework 2  - Basic Components
Zend Framework 2 - Basic Components
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
Drupalcon 2023 - How Drupal builds your pages.pdf
Drupalcon 2023 - How Drupal builds your pages.pdfDrupalcon 2023 - How Drupal builds your pages.pdf
Drupalcon 2023 - How Drupal builds your pages.pdf
 
2023 - Drupalcon - How Drupal builds your pages
2023 - Drupalcon - How Drupal builds your pages2023 - Drupalcon - How Drupal builds your pages
2023 - Drupalcon - How Drupal builds your pages
 
Intro to Laravel 4
Intro to Laravel 4Intro to Laravel 4
Intro to Laravel 4
 
Drupal 8 migrate!
Drupal 8 migrate!Drupal 8 migrate!
Drupal 8 migrate!
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
 
Patterns Are Good For Managers
Patterns Are Good For ManagersPatterns Are Good For Managers
Patterns Are Good For Managers
 
Magento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowMagento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request Flow
 
Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
Debugging in drupal 8
Debugging in drupal 8Debugging in drupal 8
Debugging in drupal 8
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & Tools
 
Fatc
FatcFatc
Fatc
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency Injection
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 

Mehr von LEDC 2016

A. Postnikov & P. Mahrinsky — Drupal Community — це ми
A. Postnikov & P. Mahrinsky — Drupal Community — це миA. Postnikov & P. Mahrinsky — Drupal Community — це ми
A. Postnikov & P. Mahrinsky — Drupal Community — це миLEDC 2016
 
Слава Мережко — Практикум: "Як ростити розробників"
Слава Мережко — Практикум: "Як ростити розробників"Слава Мережко — Практикум: "Як ростити розробників"
Слава Мережко — Практикум: "Як ростити розробників"LEDC 2016
 
Генадій Колтун — Комунізм наступає: що будемо робити, коли машини навчаться п...
Генадій Колтун — Комунізм наступає: що будемо робити, коли машини навчаться п...Генадій Колтун — Комунізм наступає: що будемо робити, коли машини навчаться п...
Генадій Колтун — Комунізм наступає: що будемо робити, коли машини навчаться п...LEDC 2016
 
Олексій Калініченко — Configuration Management in Drupal8
Олексій Калініченко — Configuration Management in Drupal8Олексій Калініченко — Configuration Management in Drupal8
Олексій Калініченко — Configuration Management in Drupal8LEDC 2016
 
Олександр Лінивий — Multisite platform with continuous delivery process for m...
Олександр Лінивий — Multisite platform with continuous delivery process for m...Олександр Лінивий — Multisite platform with continuous delivery process for m...
Олександр Лінивий — Multisite platform with continuous delivery process for m...LEDC 2016
 
Андрій Юн — Воркшоп "Docker use cases for developers"
Андрій Юн — Воркшоп "Docker use cases for developers"Андрій Юн — Воркшоп "Docker use cases for developers"
Андрій Юн — Воркшоп "Docker use cases for developers"LEDC 2016
 
Андрій Поданенко — Воркшоп "Розвертання CIBox"
Андрій Поданенко — Воркшоп "Розвертання CIBox"Андрій Поданенко — Воркшоп "Розвертання CIBox"
Андрій Поданенко — Воркшоп "Розвертання CIBox"LEDC 2016
 
Юрій Герасімов — Editorial experience in Drupal8
Юрій Герасімов — Editorial experience in Drupal8Юрій Герасімов — Editorial experience in Drupal8
Юрій Герасімов — Editorial experience in Drupal8LEDC 2016
 
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...LEDC 2016
 
Тарас Кирилюк — Docker basics. How-to for Drupal developers
Тарас Кирилюк — Docker basics. How-to for Drupal developersТарас Кирилюк — Docker basics. How-to for Drupal developers
Тарас Кирилюк — Docker basics. How-to for Drupal developersLEDC 2016
 
Тарас Круц — Open Social: brand new Drupal 8 distro for building social netwo...
Тарас Круц — Open Social: brand new Drupal 8 distro for building social netwo...Тарас Круц — Open Social: brand new Drupal 8 distro for building social netwo...
Тарас Круц — Open Social: brand new Drupal 8 distro for building social netwo...LEDC 2016
 
Ігор Карпиленко — PHPStorm for drupal developer
Ігор Карпиленко — PHPStorm for drupal developerІгор Карпиленко — PHPStorm for drupal developer
Ігор Карпиленко — PHPStorm for drupal developerLEDC 2016
 
Олександр Щедров — Build your application in seconds and optimize workflow as...
Олександр Щедров — Build your application in seconds and optimize workflow as...Олександр Щедров — Build your application in seconds and optimize workflow as...
Олександр Щедров — Build your application in seconds and optimize workflow as...LEDC 2016
 
Анатолій Поляков — Subdomains everywhere
Анатолій Поляков — Subdomains everywhereАнатолій Поляков — Subdomains everywhere
Анатолій Поляков — Subdomains everywhereLEDC 2016
 
Артем Доценко — Deploy Plus. Better UI and more control for deploy module
Артем Доценко — Deploy Plus. Better UI and more control for deploy moduleАртем Доценко — Deploy Plus. Better UI and more control for deploy module
Артем Доценко — Deploy Plus. Better UI and more control for deploy moduleLEDC 2016
 
Сергій Бондаренко — Тестування Drupal сайтiв з допогою TqExtension
Сергій Бондаренко — Тестування Drupal сайтiв з допогою TqExtensionСергій Бондаренко — Тестування Drupal сайтiв з допогою TqExtension
Сергій Бондаренко — Тестування Drupal сайтiв з допогою TqExtensionLEDC 2016
 
Вадим Абрамчук — Big Drupal: Issues We Met
Вадим Абрамчук — Big Drupal: Issues We MetВадим Абрамчук — Big Drupal: Issues We Met
Вадим Абрамчук — Big Drupal: Issues We MetLEDC 2016
 
Юрій Герасимов — Delayed operations with queues
Юрій Герасимов — Delayed operations with queuesЮрій Герасимов — Delayed operations with queues
Юрій Герасимов — Delayed operations with queuesLEDC 2016
 
Віталій Бобров — Web components, Polymer and Drupal
Віталій Бобров — Web components, Polymer and DrupalВіталій Бобров — Web components, Polymer and Drupal
Віталій Бобров — Web components, Polymer and DrupalLEDC 2016
 
Олександр Щедров та Альбіна Тюпа — Magic button. Can production releases be s...
Олександр Щедров та Альбіна Тюпа — Magic button. Can production releases be s...Олександр Щедров та Альбіна Тюпа — Magic button. Can production releases be s...
Олександр Щедров та Альбіна Тюпа — Magic button. Can production releases be s...LEDC 2016
 

Mehr von LEDC 2016 (20)

A. Postnikov & P. Mahrinsky — Drupal Community — це ми
A. Postnikov & P. Mahrinsky — Drupal Community — це миA. Postnikov & P. Mahrinsky — Drupal Community — це ми
A. Postnikov & P. Mahrinsky — Drupal Community — це ми
 
Слава Мережко — Практикум: "Як ростити розробників"
Слава Мережко — Практикум: "Як ростити розробників"Слава Мережко — Практикум: "Як ростити розробників"
Слава Мережко — Практикум: "Як ростити розробників"
 
Генадій Колтун — Комунізм наступає: що будемо робити, коли машини навчаться п...
Генадій Колтун — Комунізм наступає: що будемо робити, коли машини навчаться п...Генадій Колтун — Комунізм наступає: що будемо робити, коли машини навчаться п...
Генадій Колтун — Комунізм наступає: що будемо робити, коли машини навчаться п...
 
Олексій Калініченко — Configuration Management in Drupal8
Олексій Калініченко — Configuration Management in Drupal8Олексій Калініченко — Configuration Management in Drupal8
Олексій Калініченко — Configuration Management in Drupal8
 
Олександр Лінивий — Multisite platform with continuous delivery process for m...
Олександр Лінивий — Multisite platform with continuous delivery process for m...Олександр Лінивий — Multisite platform with continuous delivery process for m...
Олександр Лінивий — Multisite platform with continuous delivery process for m...
 
Андрій Юн — Воркшоп "Docker use cases for developers"
Андрій Юн — Воркшоп "Docker use cases for developers"Андрій Юн — Воркшоп "Docker use cases for developers"
Андрій Юн — Воркшоп "Docker use cases for developers"
 
Андрій Поданенко — Воркшоп "Розвертання CIBox"
Андрій Поданенко — Воркшоп "Розвертання CIBox"Андрій Поданенко — Воркшоп "Розвертання CIBox"
Андрій Поданенко — Воркшоп "Розвертання CIBox"
 
Юрій Герасімов — Editorial experience in Drupal8
Юрій Герасімов — Editorial experience in Drupal8Юрій Герасімов — Editorial experience in Drupal8
Юрій Герасімов — Editorial experience in Drupal8
 
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
 
Тарас Кирилюк — Docker basics. How-to for Drupal developers
Тарас Кирилюк — Docker basics. How-to for Drupal developersТарас Кирилюк — Docker basics. How-to for Drupal developers
Тарас Кирилюк — Docker basics. How-to for Drupal developers
 
Тарас Круц — Open Social: brand new Drupal 8 distro for building social netwo...
Тарас Круц — Open Social: brand new Drupal 8 distro for building social netwo...Тарас Круц — Open Social: brand new Drupal 8 distro for building social netwo...
Тарас Круц — Open Social: brand new Drupal 8 distro for building social netwo...
 
Ігор Карпиленко — PHPStorm for drupal developer
Ігор Карпиленко — PHPStorm for drupal developerІгор Карпиленко — PHPStorm for drupal developer
Ігор Карпиленко — PHPStorm for drupal developer
 
Олександр Щедров — Build your application in seconds and optimize workflow as...
Олександр Щедров — Build your application in seconds and optimize workflow as...Олександр Щедров — Build your application in seconds and optimize workflow as...
Олександр Щедров — Build your application in seconds and optimize workflow as...
 
Анатолій Поляков — Subdomains everywhere
Анатолій Поляков — Subdomains everywhereАнатолій Поляков — Subdomains everywhere
Анатолій Поляков — Subdomains everywhere
 
Артем Доценко — Deploy Plus. Better UI and more control for deploy module
Артем Доценко — Deploy Plus. Better UI and more control for deploy moduleАртем Доценко — Deploy Plus. Better UI and more control for deploy module
Артем Доценко — Deploy Plus. Better UI and more control for deploy module
 
Сергій Бондаренко — Тестування Drupal сайтiв з допогою TqExtension
Сергій Бондаренко — Тестування Drupal сайтiв з допогою TqExtensionСергій Бондаренко — Тестування Drupal сайтiв з допогою TqExtension
Сергій Бондаренко — Тестування Drupal сайтiв з допогою TqExtension
 
Вадим Абрамчук — Big Drupal: Issues We Met
Вадим Абрамчук — Big Drupal: Issues We MetВадим Абрамчук — Big Drupal: Issues We Met
Вадим Абрамчук — Big Drupal: Issues We Met
 
Юрій Герасимов — Delayed operations with queues
Юрій Герасимов — Delayed operations with queuesЮрій Герасимов — Delayed operations with queues
Юрій Герасимов — Delayed operations with queues
 
Віталій Бобров — Web components, Polymer and Drupal
Віталій Бобров — Web components, Polymer and DrupalВіталій Бобров — Web components, Polymer and Drupal
Віталій Бобров — Web components, Polymer and Drupal
 
Олександр Щедров та Альбіна Тюпа — Magic button. Can production releases be s...
Олександр Щедров та Альбіна Тюпа — Magic button. Can production releases be s...Олександр Щедров та Альбіна Тюпа — Magic button. Can production releases be s...
Олександр Щедров та Альбіна Тюпа — Magic button. Can production releases be s...
 

Kürzlich hochgeladen

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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
[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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - 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
 

Kürzlich hochgeladen (20)

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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
[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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - 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)
 

Andy Postnikov - Drupal 7 vs Drupal 8: от бутстрапа до рендера

  • 1. Drupal 7 vs 8 Andy Postnikov Freelancer & Alexey Gaydabura Lead Developer at @SkillD Lviv, 2013 http://www.skilld.fr
  • 3. Drupal 7 - install.php if (version_compare(PHP_VERSION, '5.2.4') < 0) { exit; } Drupal 8 - install.php chdir('..'); require_once __DIR__ . '/vendor/autoload.php'; if (version_compare(PHP_VERSION, '5.3.10') < 0) { exit; } if (ini_get('safe_mode')) { print 'Your PHP installation has safe_mode enabled. ...'; exit; }
  • 4. Drupal 7 - index.php define('DRUPAL_ROOT', getcwd()); require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); menu_execute_active_handler(); Drupal 8 - index.php require_once __DIR__ . '/core/vendor/autoload.php'; require_once __DIR__ . '/core/includes/bootstrap.inc'; try { drupal_handle_request(); } catch (Exception $e) { print 'If you have ... read http://drupal.org/documentation/rebuild'; throw $e; }
  • 5. Drupal 7 - Bootstrap 1. DRUPAL_BOOTSTRAP_CONFIGURATION 2. DRUPAL_BOOTSTRAP_PAGE_CACHE 3. DRUPAL_BOOTSTRAP_DATABASE 4. DRUPAL_BOOTSTRAP_VARIABLES 5. DRUPAL_BOOTSTRAP_SESSION 6. DRUPAL_BOOTSTRAP_PAGE_HEADER 7. DRUPAL_BOOTSTRAP_LANGUAGE 8. DRUPAL_BOOTSTRAP_FULL
  • 6. Drupal 8 - Bootstrap 1. DRUPAL_BOOTSTRAP_CONFIGURATION + DRUPAL_BOOTSTRAP_KERNEL 2. DRUPAL_BOOTSTRAP_PAGE_CACHE 3. DRUPAL_BOOTSTRAP_DATABASE DRUPAL_BOOTSTRAP_VARIABLES - DRUPAL_BOOTSTRAP_SESSION - DRUPAL_BOOTSTRAP_PAGE_HEADER - DRUPAL_BOOTSTRAP_LANGUAGE + DRUPAL_BOOTSTRAP_CODE DRUPAL_BOOTSTRAP_FULL (language + theme) Should be 3 steps - https://drupal.org/node/2023495
  • 7. Drupal 7: Menu page callback $result = _menu_site_is_offline() ? MENU_SITE_OFFLINE : MENU_SITE_ONLINE; drupal_alter('menu_site_status', $result, ...); $result = call_user_func_array( $router['page_callback'], $router['page_arguments']); drupal_alter('page_delivery_callback', $delivery_callback); drupal_deliver_html_page() drupal_render_page() - hook_page_build() + hook_page() drupal_page_footer()
  • 8. Drupal 8: Symfony drupal_handle_request() // Initialize the environment, load settings.php, and activate a PSR-0 class // autoloader with required namespaces registered. drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION); $kernel = new DrupalKernel('prod', drupal_classloader(), !$test_only); // @todo Remove this once everything in the bootstrap has been // converted to services in the DIC. $kernel->boot(); drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE); // Create a request object from the HttpFoundation. $request = Request::createFromGlobals(); $response = $kernel->handle($request) ->prepare($request)->send(); $kernel->terminate($request, $response);
  • 9. D7: Hook, alter, preprocess! ● ● ● ● ● Core hooks Custom hooks Alter everything Preprocess anything Theme suggestions You are the King!
  • 10. D8: Hook, alter, preprocess! + Subscribe ● ● ● ● ● ● Kernel & Routing events Core hooks Custom hooks Alter everything Preprocess anything Theme suggestions ++ You are the King!
  • 11. D8: Subscribe kernel namespace SymfonyComponentHttpKernel; final class KernelEvents ● ● ● ● ● ● REQUEST - hook_boot() CONTROLLER - menu “page callback” VIEW - hook_page_build() RESPONSE - hook_page_alter() TERMINATE - hook_exit() EXCEPTION
  • 12. D8: Subscribe routing namespace DrupalCoreRouting; final class RoutingEvents { const ALTER = 'routing.route_alter'; const DYNAMIC = 'routing.route_dynamic'; }
  • 13. D8: Subscribe and alter namespace DrupalCoreEventSubscriber; class AccessSubscriber implements EventSubscriberInterface { static function getSubscribedEvents() { $events[KernelEvents::REQUEST][] = array ('onKernelRequestAccessCheck', 30); // Setting very low priority to ensure access checks are run after alters. $events[RoutingEvents::ALTER][] = array ('onRoutingRouteAlterSetAccessCheck', -50); return $events; } }
  • 15. D8: Hook, alter, preprocess function telephone_field_info_alter(&$info) { if (Drupal::moduleHandler()->moduleExists('text')) { $info['telephone']['default_formatter'] = 'text_plain'; } } function telephone_field_formatter_info_alter(&$info) { if (isset($info['text_plain'])) { $info['text_plain']['field_types'][] = 'telephone'; } }
  • 16. D7: My.module vs altering ● hook_menu() $items['mypath'] = array( 'page callback' => 'mypath_page_view' 'theme callback' => 'theme_mypath_page_view' 'delivery callback' => 'deliver_mypath_page_view' ● ● hook_theme() mypath_page_view($arg); VS ● ● ● ● hook_menu_alter() hook_theme_registry_alter() mycore_page_view() mycore_page_theme()
  • 17. D7: My.module hook_menu() 1. 2. 3. 4. 5. 6. Routing Menu links Local actions Local tasks Breadcrumbs Contextual links
  • 18. D8: My.module NO hook_menu() 1. my.routing.yml 2. my_default_menu_links() 3. my.local_actions.yml 4. my.local_tasks.yml 5. class MyBreadcrumbBuilder 6. my.contextual_links.yml 7. my.services.yml
  • 19. D8: My.module vs altering hook_”world”_alter() - THE SAME! class MyEventSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents(); } class MyServiceProvider implements ServiceProviderInterface, ServiceModifierInterface { public function register(ContainerBuilder $container) {} public function alter(ContainerBuilder $container) {} }
  • 20. D8: Services & Managers
  • 21. D7 vs D8: render Render array (‘#theme’ => ‘item_list’,‘#items’ => array()) https://drupal.org/node/2068471 + $events[KernelEvents::VIEW][] = array('onHtmlFragment', 100); + $events[KernelEvents::VIEW][] = array('onHtmlPage', 50); class Link extends HeadElement class Metatag extends HeadElement class HeadElement class HtmlPage extends HtmlFragment class HtmlFragment
  • 22. When it’s ready™? https://drupal.org/node/2107085 http://xjm.drupalgardens.com/blog/when-its-ready no more hook_menu() no more variable_get() complete language negotiation complete entity field api
  • 24. Drupal 7 vs 8 Anderey Postnikov Alexey Gaydabura Freelance Developer Skype: andypost E-mail: apostnikov@gmail.com Lead Developer at @SkillD Skype: alexey.gaydabura E-mail: gaydabura@gmail.com http://www.skilld.fr