SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Similar a 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
 

Similar a 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
 

Más de 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
 

Más de 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...
 

Último

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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Último (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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
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?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

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