SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
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);
● hook_menu_alter()
● hook_theme_registry_alter()
● mycore_page_view()
● mycore_page_theme()
VS
D7: My.module hook_menu()
1. Routing
2. Menu links
3. Local actions
4. Local tasks
5. Breadcrumbs
6. 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?
Anderey Postnikov
Freelance Developer
Skype: andypost
E-mail: apostnikov@gmail.com
http://www.skilld.fr
Drupal 7 vs 8
Alexey Gaydabura
Lead Developer at @SkillD
Skype: alexey.gaydabura
E-mail: gaydabura@gmail.com

Mais conteúdo relacionado

Mais procurados

Laravel Design Patterns
Laravel Design PatternsLaravel Design Patterns
Laravel Design PatternsBobby Bouwmann
 
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
 
Codeigniter4の比較と検証
Codeigniter4の比較と検証Codeigniter4の比較と検証
Codeigniter4の比較と検証ME iBotch
 
XamarinとAWSをつないでみた話
XamarinとAWSをつないでみた話XamarinとAWSをつないでみた話
XamarinとAWSをつないでみた話Takehito Tanabe
 
Jlook web ui framework
Jlook web ui frameworkJlook web ui framework
Jlook web ui frameworkHongSeong Jeon
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationJace Ju
 
#34.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자교육,국...
#34.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자교육,국...#34.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자교육,국...
#34.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자교육,국...탑크리에듀(구로디지털단지역3번출구 2분거리)
 
Spring Framework Petclinic sample application
Spring Framework Petclinic sample applicationSpring Framework Petclinic sample application
Spring Framework Petclinic sample applicationAntoine Rey
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications Juliana Lucena
 
Django + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar DjangoDjango + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar DjangoJavier Abadía
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesLindsay Holmwood
 
Zagreb workshop
Zagreb workshopZagreb workshop
Zagreb workshopLynn Root
 
Step By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts AppStep By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts AppSyed Shahul
 
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
 
TYPO3 Flow 2.0 (T3CON13 San Francisco)
TYPO3 Flow 2.0 (T3CON13 San Francisco)TYPO3 Flow 2.0 (T3CON13 San Francisco)
TYPO3 Flow 2.0 (T3CON13 San Francisco)Robert Lemke
 
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forGradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forCorneil du Plessis
 

Mais procurados (20)

Java Server Faces
Java Server FacesJava Server Faces
Java Server Faces
 
Laravel Design Patterns
Laravel Design PatternsLaravel Design Patterns
Laravel Design Patterns
 
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
 
Codeigniter4の比較と検証
Codeigniter4の比較と検証Codeigniter4の比較と検証
Codeigniter4の比較と検証
 
Vue business first
Vue business firstVue business first
Vue business first
 
XamarinとAWSをつないでみた話
XamarinとAWSをつないでみた話XamarinとAWSをつないでみた話
XamarinとAWSをつないでみた話
 
Jlook web ui framework
Jlook web ui frameworkJlook web ui framework
Jlook web ui framework
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & Application
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
 
#34.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자교육,국...
#34.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자교육,국...#34.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자교육,국...
#34.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자교육,국...
 
Spring Framework Petclinic sample application
Spring Framework Petclinic sample applicationSpring Framework Petclinic sample application
Spring Framework Petclinic sample application
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
 
Django + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar DjangoDjango + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar Django
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Zagreb workshop
Zagreb workshopZagreb workshop
Zagreb workshop
 
Flask Basics
Flask BasicsFlask Basics
Flask Basics
 
Step By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts AppStep By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts App
 
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)
 
TYPO3 Flow 2.0 (T3CON13 San Francisco)
TYPO3 Flow 2.0 (T3CON13 San Francisco)TYPO3 Flow 2.0 (T3CON13 San Francisco)
TYPO3 Flow 2.0 (T3CON13 San Francisco)
 
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forGradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting for
 

Destaque

Drupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances DrupalDrupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances DrupalSkilld
 
[DCTPE2010] Drupal & (Open/Anti) Government
[DCTPE2010] Drupal & (Open/Anti) Government[DCTPE2010] Drupal & (Open/Anti) Government
[DCTPE2010] Drupal & (Open/Anti) GovernmentDrupal Taiwan
 
Retrospective 2013 de la communauté Drupal 8
Retrospective 2013 de la communauté Drupal 8Retrospective 2013 de la communauté Drupal 8
Retrospective 2013 de la communauté Drupal 8Skilld
 
Retrospective 2013 de Drupal !
Retrospective 2013 de Drupal !Retrospective 2013 de Drupal !
Retrospective 2013 de Drupal !Skilld
 
Drupal Camp Kiev 2012 - High Performance Drupal Web Sites
Drupal Camp Kiev 2012 - High Performance Drupal Web SitesDrupal Camp Kiev 2012 - High Performance Drupal Web Sites
Drupal Camp Kiev 2012 - High Performance Drupal Web SitesSkilld
 
Drupal, les hackers, la sécurité & les (très) grands comptes
Drupal, les hackers, la sécurité & les (très) grands comptesDrupal, les hackers, la sécurité & les (très) grands comptes
Drupal, les hackers, la sécurité & les (très) grands comptesSkilld
 

Destaque (6)

Drupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances DrupalDrupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances Drupal
 
[DCTPE2010] Drupal & (Open/Anti) Government
[DCTPE2010] Drupal & (Open/Anti) Government[DCTPE2010] Drupal & (Open/Anti) Government
[DCTPE2010] Drupal & (Open/Anti) Government
 
Retrospective 2013 de la communauté Drupal 8
Retrospective 2013 de la communauté Drupal 8Retrospective 2013 de la communauté Drupal 8
Retrospective 2013 de la communauté Drupal 8
 
Retrospective 2013 de Drupal !
Retrospective 2013 de Drupal !Retrospective 2013 de Drupal !
Retrospective 2013 de Drupal !
 
Drupal Camp Kiev 2012 - High Performance Drupal Web Sites
Drupal Camp Kiev 2012 - High Performance Drupal Web SitesDrupal Camp Kiev 2012 - High Performance Drupal Web Sites
Drupal Camp Kiev 2012 - High Performance Drupal Web Sites
 
Drupal, les hackers, la sécurité & les (très) grands comptes
Drupal, les hackers, la sécurité & les (très) grands comptesDrupal, les hackers, la sécurité & les (très) grands comptes
Drupal, les hackers, la sécurité & les (très) grands comptes
 

Semelhante a Lviv 2013 d7 vs d8

Andy Postnikov - Drupal 7 vs Drupal 8: от бутстрапа до рендера
Andy Postnikov - Drupal 7 vs Drupal 8: от бутстрапа до рендераAndy Postnikov - Drupal 7 vs Drupal 8: от бутстрапа до рендера
Andy Postnikov - Drupal 7 vs Drupal 8: от бутстрапа до рендераLEDC 2016
 
Zend Framework 2 - Basic Components
Zend Framework 2  - Basic ComponentsZend Framework 2  - Basic Components
Zend Framework 2 - Basic ComponentsMateusz Tymek
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenchesLukas Smith
 
Magento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowMagento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowVrann Tulika
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207patter
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5Darren Craig
 
Patterns Are Good For Managers
Patterns Are Good For ManagersPatterns Are Good For Managers
Patterns Are Good For ManagersAgileThought
 
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
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
Laravel5 Introduction and essentials
Laravel5 Introduction and essentialsLaravel5 Introduction and essentials
Laravel5 Introduction and essentialsPramod Kadam
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js frameworkBen Lin
 
ZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperGary Hockin
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionPhilip Norton
 
From framework coupled code to #microservices through #DDD /by @codelytv
From framework coupled code to #microservices through #DDD /by @codelytvFrom framework coupled code to #microservices through #DDD /by @codelytv
From framework coupled code to #microservices through #DDD /by @codelytvCodelyTV
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & ToolsIan Barber
 

Semelhante a Lviv 2013 d7 vs d8 (20)

Andy Postnikov - Drupal 7 vs Drupal 8: от бутстрапа до рендера
Andy Postnikov - Drupal 7 vs Drupal 8: от бутстрапа до рендераAndy Postnikov - Drupal 7 vs Drupal 8: от бутстрапа до рендера
Andy Postnikov - Drupal 7 vs Drupal 8: от бутстрапа до рендера
 
Zend Framework 2 - Basic Components
Zend Framework 2  - Basic ComponentsZend Framework 2  - Basic Components
Zend Framework 2 - Basic Components
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenches
 
Magento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowMagento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request Flow
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
Patterns Are Good For Managers
Patterns Are Good For ManagersPatterns Are Good For Managers
Patterns Are Good For Managers
 
Intro to Laravel 4
Intro to Laravel 4Intro to Laravel 4
Intro to Laravel 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
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
Laravel5 Introduction and essentials
Laravel5 Introduction and essentialsLaravel5 Introduction and essentials
Laravel5 Introduction and essentials
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
 
ZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperZF2 for the ZF1 Developer
ZF2 for the ZF1 Developer
 
Drupal 8 migrate!
Drupal 8 migrate!Drupal 8 migrate!
Drupal 8 migrate!
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency Injection
 
From framework coupled code to #microservices through #DDD /by @codelytv
From framework coupled code to #microservices through #DDD /by @codelytvFrom framework coupled code to #microservices through #DDD /by @codelytv
From framework coupled code to #microservices through #DDD /by @codelytv
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & Tools
 

Mais de Skilld

201910 skilld presentation-societe
201910 skilld presentation-societe201910 skilld presentation-societe
201910 skilld presentation-societeSkilld
 
Session Drupagora 2019 - Agilité dans tous ses états
Session Drupagora 2019 - Agilité dans tous ses étatsSession Drupagora 2019 - Agilité dans tous ses états
Session Drupagora 2019 - Agilité dans tous ses étatsSkilld
 
Case study : 2 applications mobiles réalisées avec Drupal
Case study : 2 applications mobiles réalisées avec DrupalCase study : 2 applications mobiles réalisées avec Drupal
Case study : 2 applications mobiles réalisées avec DrupalSkilld
 
Lviv eurodrupalcamp 2015 - drupal contributor howto
Lviv eurodrupalcamp 2015  - drupal contributor howtoLviv eurodrupalcamp 2015  - drupal contributor howto
Lviv eurodrupalcamp 2015 - drupal contributor howtoSkilld
 
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...Skilld
 
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...Skilld
 
Drupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances DrupalDrupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances DrupalSkilld
 

Mais de Skilld (7)

201910 skilld presentation-societe
201910 skilld presentation-societe201910 skilld presentation-societe
201910 skilld presentation-societe
 
Session Drupagora 2019 - Agilité dans tous ses états
Session Drupagora 2019 - Agilité dans tous ses étatsSession Drupagora 2019 - Agilité dans tous ses états
Session Drupagora 2019 - Agilité dans tous ses états
 
Case study : 2 applications mobiles réalisées avec Drupal
Case study : 2 applications mobiles réalisées avec DrupalCase study : 2 applications mobiles réalisées avec Drupal
Case study : 2 applications mobiles réalisées avec Drupal
 
Lviv eurodrupalcamp 2015 - drupal contributor howto
Lviv eurodrupalcamp 2015  - drupal contributor howtoLviv eurodrupalcamp 2015  - drupal contributor howto
Lviv eurodrupalcamp 2015 - drupal contributor howto
 
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
 
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
 
Drupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances DrupalDrupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances Drupal
 

Último

UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 

Último (20)

UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 

Lviv 2013 d7 vs d8

  • 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); ● hook_menu_alter() ● hook_theme_registry_alter() ● mycore_page_view() ● mycore_page_theme() VS
  • 17. D7: My.module hook_menu() 1. Routing 2. Menu links 3. Local actions 4. Local tasks 5. Breadcrumbs 6. 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. Anderey Postnikov Freelance Developer Skype: andypost E-mail: apostnikov@gmail.com http://www.skilld.fr Drupal 7 vs 8 Alexey Gaydabura Lead Developer at @SkillD Skype: alexey.gaydabura E-mail: gaydabura@gmail.com