SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
The Drupal 8 Render
Pipeline
Anish M. M.
Adrian McDonald Tariang
Summer Interns
Date: 2017-06-08
From Request to Response
Introduction
In order to generate a response for a request, Drupal
performs a sequence of steps, called the Drupal
Render Pipeline. In the following slides, we will go
through these steps one by one.
Request to Response
Drupal’s Request Processing
The Drupal Application
1.The Front Controller[index.php]
This is the entry point of execution where Drupal
creates the Request Object from the HTTP request,
processes it and and returns the response back to
the browser.
1.The Front Controller[index.php]
Key Components
HttpFoundation
Component of Symfony that creates an object-
oriented layer from the superglobals of the PHP
request.
HttpKernel
Another Symfony component used to provide a
structured pipeline to render a response for the
Drupal System.
Loads all the dependencies using the autoload.php
file.
Instantiates the DrupalKernel class.
Creates a $request object of Symfony’s Request
class from the component HttpFoundation.
Calls the DrupalKernel::handle() method and passes
the $request object as argument.
1.The Front Controller[index.php]
Steps Followed
DrupalKernel::handle()
This handle() method :
Calls DrupalKernel::bootEnvironment() -
which sets the PHP environment variables that
need to be set to ensure security.
Calls DrupalKernel::initializeSettings() which
locates site path and initializes the Drupal
settings.
Calls HttpKernel::handle() method which is a
part of the Symfony component HttpKernel.
HttpKernel::handle()
Events, Event Listeners.
An event is like a notice on a bulletin board. Event
Listeners are the people who wait (‘listen’) for a
notice. Listeners listen for a particular kind of event,
say, for a kernel.exception event. Dispatching an
event is like putting it on the notice board.
When the event they are listening to is dispatched,
they check whether they can perform the required
action. If so, they respond to the dispatched event
using the setResponse() method and stops the
propagation of the event.
REQUEST event
During this event, exceptions could occur which
could run its own controller (see kernel.exception)
and send back a response.
The first event in the
kernel.handle() method.
Subscribers to the request
event perform task such as:
1. Format negotiation of the
response data i.e. html, json.
2. Controller selection to
handle the request.
REQUEST event Subscribers
in order of execution
Routing
Drupal’s routing system is responsible for
providing an appropriate controller to a requested
path.
It is based on the Symfony component Routing,
which uses routes.yml files present in the module
directory to map the routes to controllers.
The route file contains data such as the format the
response is to be produced, the controller to be
used, security requirements and other supporting
data.
RouteBuilder::rebuild()
building the route information
This workflow represents how
the routes are loaded from
the modules’ routing.yml
files and other sources into
the Drupal database.
Routing
The controller performs the business logic for the
application.
The routing.yml file contains one of these
“controller” types:
_content
_controller
_form
_entity[_form | _view | _list]
Which specify how the output is generated. This
data is then set into the request attributes.
Routing Example
In this example, during the
request event, if the URL request is
as specified in `path`, the
controller defined at `_form` is to
be used to provide the given menu
form.
This YAML file also specifies that
the client needs to be logged in to
access the page.
colorbox.routing.yml
file to the Colorbox
module.
An example request:
Controller Resolution
Now, the handle()
method is required to
select the exact
Controller using the
request attributes that
was set by the routing
Component.
This is performed using the getController() method of
a class implementing the ControllerResolverInterface
of the Symfony component HttpKernel.
Resolving Controller
Parameters
The given section is used to
provide an array of
arguments for the Controller
to operate.
This is performed by the
Drupal System and may even
include the entire request
object if required.
CONTROLLER event
During this event,
subscribers or listeners
perform initialization or
testing before the controller
is allowed to be executed.
The Listeners also have the
privilege to change the
Controller to be used if
required.
Resolving Controller
Parameters
The given section is used to
provide an array of
arguments for the Controller
to operate.
This is performed by the
Drupal System and may even
include the entire request
object if required.
Calling the controller
The selected controller is
now called by handle() with
its arguments. The Drupal
controllers return either:
The Response Object
Render Array
or other objects.
If the controller returns a response object, it moves
directly to the response event without going
through the view event.
Render arrays and other objects are converted into
Response objects through the listeners of the view
event, which is dispatched after controller
completion.
VIEW event
Listeners to this event, also
called View Subscribers,
convert render arrays and
objects into Response objects
by delegating the task to
specified renderers to a given
format. (html, json, xml).
Listeners, can also use
templates to provide the
response object in the
specified format.
Render Arrays
Example:
Render Array HTML Output
Through a Content Renderer
Render Arrays
A render array is a classic Drupal structured array
that provides data (probably nested) along with
hints as to how it should be rendered (properties
like #type).
Modules have the capability of defining “elements”,
which are essentially prepackaged default render
arrays. They use hook_element_info() to do this.
When #type is declared for a render array, the
default properties of the element type named are
loaded through the use of hook_element_info().
Render Arrays
They allow the modules to treat the content as
data for as long as possible in the page
generation process.
MainContentViewSubscriber
This view subscriber converts Render Arrays into
Response objects. It checks whether a maincontent
renderer service for the requested response format
exists. If it does, it is initialized. Else, a 406 (Not
Acceptable) response is generated.
Other objects may be converted by corresponding
view subscribers on seeing the kernel.view event,
either directly into Response objects, or into Render
Arrays. In the latter case, the
MainContentViewSubscriber converts it into a
Response object.
RESPONSE event
During the event, final
modifications are performed
over the Response object
such as inserting javascripts
or cookies.
Placeholders in the Response
object are replaced through
Placeholder Strategies such
as BigPipe and SingleFlush.
It is after this event that the
Response is sent back to the
Front controller through the
handle() method.
SingleFlush vs BigPipe
Caching
Cache, in computing, is a component that stores
frequently used data so that future requests for that
data can be served faster.
Frequently used / common data can be cached and
loaded faster, while dynamic / personalized data is
generated.
In Drupal 8, Caching is performed through cache-
tags, cache-contexts and max-age.
SingleFlush vs BigPipe
By default, responses to requests are delivered in a
SingleFlush method.
The server generates all the content to be
displayed and then dumps it to the browser screen.
So, entire pages are cache-able, but not as parts of
one.
Here, the perceived time for loading the web page
is more and user has to sometimes stare at a white
screen till the full page loads.
SingleFlush vs BigPipe
An alternative to SingleFlush, is the BigPipe
method.
Here, the pages are sent in a way which allows the
browser to display them much faster.
Caching of parts of pages is possible.
So, the cached parts are displayed and then the
dynamic parts are added as and when received.
The total time for loading the page may be the
same, but the perceived time is lesser.
Also, the user is provided with some workable
content before the whole page is loaded.
TERMINATE event
This event is triggered after
the Response object is
already sent back to the
client.
Used to perform slower tasks
such as system logging and
sending emails which now
would not increase response
time.
This is made possible by the
TerminableInterface provided
by the Symfony component
HttpKernel.
EXCEPTION event
Triggered to handle
exceptions and tailor
appropriate responses to the
client.
For example, if the client does
not have sufficient
permissions or if the
requested data does not
exist.
An exception is also thrown
when no listeners to events
such as request and view are
triggered.
References
Site Point: From Request to Response
Drupal Render API Documentation
Drupal 8 Render Pipeline talk
Symfony 2 HttpKernel Component
Drupal API Documentation
Drupal Cache API Documentation
Credits
Wim Leers, author to material such as the
render pipeline diagram and the DrupalCon talk,
which have been used extensively in this
presentation.
Images taken from symfony.com/docs
Contact Zyxware
Website: http://www.zyxware.com
Email : drupal@zyxware.com
Phone : +91-8606011184

Mais conteúdo relacionado

Mais procurados

Servlet ppt by vikas jagtap
Servlet ppt by vikas jagtapServlet ppt by vikas jagtap
Servlet ppt by vikas jagtapVikas Jagtap
 
Javax.servlet,http packages
Javax.servlet,http packagesJavax.servlet,http packages
Javax.servlet,http packagesvamsi krishna
 
An Introduction To Java Web Technology
An Introduction To Java Web TechnologyAn Introduction To Java Web Technology
An Introduction To Java Web Technologyvikram singh
 
Java Servlets
Java ServletsJava Servlets
Java ServletsEmprovise
 
Identifing Listeners and Filters
Identifing Listeners and FiltersIdentifing Listeners and Filters
Identifing Listeners and FiltersPeople Strategists
 
Servlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servletsServlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servletsJavaEE Trainers
 
Request dispatching in servlet
Request dispatching in servletRequest dispatching in servlet
Request dispatching in servletvikram singh
 
Web Tech Java Servlet Update1
Web Tech   Java Servlet Update1Web Tech   Java Servlet Update1
Web Tech Java Servlet Update1vikram singh
 
How To Utilize Context API With Class And Functional Componen in React.pptx
How To Utilize Context API With Class And Functional Componen in React.pptxHow To Utilize Context API With Class And Functional Componen in React.pptx
How To Utilize Context API With Class And Functional Componen in React.pptxBOSC Tech Labs
 
Web Application Deployment
Web Application DeploymentWeb Application Deployment
Web Application Deploymentelliando dias
 
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveDataAndroid MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveDataWaheed Nazir
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technologyMinal Maniar
 
Academy PRO: React JS
Academy PRO: React JSAcademy PRO: React JS
Academy PRO: React JSBinary Studio
 
Android AsyncTask Tutorial
Android AsyncTask TutorialAndroid AsyncTask Tutorial
Android AsyncTask TutorialPerfect APK
 
Mvc interview questions – deep dive jinal desai
Mvc interview questions – deep dive   jinal desaiMvc interview questions – deep dive   jinal desai
Mvc interview questions – deep dive jinal desaijinaldesailive
 

Mais procurados (20)

Servlet ppt by vikas jagtap
Servlet ppt by vikas jagtapServlet ppt by vikas jagtap
Servlet ppt by vikas jagtap
 
Javax.servlet,http packages
Javax.servlet,http packagesJavax.servlet,http packages
Javax.servlet,http packages
 
An Introduction To Java Web Technology
An Introduction To Java Web TechnologyAn Introduction To Java Web Technology
An Introduction To Java Web Technology
 
JAVA Servlets
JAVA ServletsJAVA Servlets
JAVA Servlets
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Identifing Listeners and Filters
Identifing Listeners and FiltersIdentifing Listeners and Filters
Identifing Listeners and Filters
 
Servlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servletsServlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servlets
 
Request dispatching in servlet
Request dispatching in servletRequest dispatching in servlet
Request dispatching in servlet
 
Web Tech Java Servlet Update1
Web Tech   Java Servlet Update1Web Tech   Java Servlet Update1
Web Tech Java Servlet Update1
 
How To Utilize Context API With Class And Functional Componen in React.pptx
How To Utilize Context API With Class And Functional Componen in React.pptxHow To Utilize Context API With Class And Functional Componen in React.pptx
How To Utilize Context API With Class And Functional Componen in React.pptx
 
Web Application Deployment
Web Application DeploymentWeb Application Deployment
Web Application Deployment
 
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveDataAndroid MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
 
Academy PRO: React JS
Academy PRO: React JSAcademy PRO: React JS
Academy PRO: React JS
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Servlet Filter
Servlet FilterServlet Filter
Servlet Filter
 
Servlets
ServletsServlets
Servlets
 
Android AsyncTask Tutorial
Android AsyncTask TutorialAndroid AsyncTask Tutorial
Android AsyncTask Tutorial
 
Spring Core
Spring CoreSpring Core
Spring Core
 
Mvc interview questions – deep dive jinal desai
Mvc interview questions – deep dive   jinal desaiMvc interview questions – deep dive   jinal desai
Mvc interview questions – deep dive jinal desai
 

Semelhante a Learn Drupal 8 Render Pipeline

Drupal 8 meets to symphony
Drupal 8 meets to symphonyDrupal 8 meets to symphony
Drupal 8 meets to symphonyBrahampal Singh
 
Android development training programme , Day 3
Android development training programme , Day 3Android development training programme , Day 3
Android development training programme , Day 3DHIRAJ PRAVIN
 
Struts tutorial
Struts tutorialStruts tutorial
Struts tutorialOPENLANE
 
Trustparency web doc spring 2.5 & hibernate
Trustparency web doc   spring 2.5 & hibernateTrustparency web doc   spring 2.5 & hibernate
Trustparency web doc spring 2.5 & hibernatetrustparency
 
Drupal8 render pipeline
Drupal8 render pipelineDrupal8 render pipeline
Drupal8 render pipelineMahesh Salaria
 
ASP.NET - Life cycle of asp
ASP.NET - Life cycle of aspASP.NET - Life cycle of asp
ASP.NET - Life cycle of asppriya Nithya
 
Symfony and Drupal 8
Symfony and Drupal 8Symfony and Drupal 8
Symfony and Drupal 8Kunal Kursija
 
Coldbox developer training – session 5
Coldbox developer training – session 5Coldbox developer training – session 5
Coldbox developer training – session 5Billie Berzinskas
 
Asp.net life cycle
Asp.net life cycleAsp.net life cycle
Asp.net life cycleIrfaan Khan
 
Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014Lou Sacco
 
Session 9 Android Web Services - Part 2.pdf
Session 9 Android Web Services - Part 2.pdfSession 9 Android Web Services - Part 2.pdf
Session 9 Android Web Services - Part 2.pdfEngmohammedAlzared
 
Asp.net By Durgesh Singh
Asp.net By Durgesh SinghAsp.net By Durgesh Singh
Asp.net By Durgesh Singhimdurgesh
 

Semelhante a Learn Drupal 8 Render Pipeline (20)

Drupal 8 meets to symphony
Drupal 8 meets to symphonyDrupal 8 meets to symphony
Drupal 8 meets to symphony
 
Android development training programme , Day 3
Android development training programme , Day 3Android development training programme , Day 3
Android development training programme , Day 3
 
Controller
ControllerController
Controller
 
2007 Zend Con Mvc Edited Irmantas
2007 Zend Con Mvc Edited Irmantas2007 Zend Con Mvc Edited Irmantas
2007 Zend Con Mvc Edited Irmantas
 
Struts tutorial
Struts tutorialStruts tutorial
Struts tutorial
 
Asp.net control
Asp.net controlAsp.net control
Asp.net control
 
Trustparency web doc spring 2.5 & hibernate
Trustparency web doc   spring 2.5 & hibernateTrustparency web doc   spring 2.5 & hibernate
Trustparency web doc spring 2.5 & hibernate
 
Angularjs
AngularjsAngularjs
Angularjs
 
Drupal8 render pipeline
Drupal8 render pipelineDrupal8 render pipeline
Drupal8 render pipeline
 
ASP.NET - Life cycle of asp
ASP.NET - Life cycle of aspASP.NET - Life cycle of asp
ASP.NET - Life cycle of asp
 
Symfony and Drupal 8
Symfony and Drupal 8Symfony and Drupal 8
Symfony and Drupal 8
 
Coldbox developer training – session 5
Coldbox developer training – session 5Coldbox developer training – session 5
Coldbox developer training – session 5
 
Spring tutorial
Spring tutorialSpring tutorial
Spring tutorial
 
CodeIgniter 101 Tutorial
CodeIgniter 101 TutorialCodeIgniter 101 Tutorial
CodeIgniter 101 Tutorial
 
Android session-5-sajib
Android session-5-sajibAndroid session-5-sajib
Android session-5-sajib
 
Asp.net life cycle
Asp.net life cycleAsp.net life cycle
Asp.net life cycle
 
ASP .net MVC
ASP .net MVCASP .net MVC
ASP .net MVC
 
Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014
 
Session 9 Android Web Services - Part 2.pdf
Session 9 Android Web Services - Part 2.pdfSession 9 Android Web Services - Part 2.pdf
Session 9 Android Web Services - Part 2.pdf
 
Asp.net By Durgesh Singh
Asp.net By Durgesh SinghAsp.net By Durgesh Singh
Asp.net By Durgesh Singh
 

Mais de Zyxware Technologies

Google Docs - Leverage the power of collaboration with shared documents
Google Docs - Leverage the power of collaboration with shared documentsGoogle Docs - Leverage the power of collaboration with shared documents
Google Docs - Leverage the power of collaboration with shared documentsZyxware Technologies
 
CETAA Vision 2025 - Making CETAA the best alumni association in India
CETAA Vision 2025 - Making CETAA the best alumni association in IndiaCETAA Vision 2025 - Making CETAA the best alumni association in India
CETAA Vision 2025 - Making CETAA the best alumni association in IndiaZyxware Technologies
 
Come, build your career at Zyxware Technologies
Come, build your career at Zyxware TechnologiesCome, build your career at Zyxware Technologies
Come, build your career at Zyxware TechnologiesZyxware Technologies
 
Personalized customer experience using ecommerce portal
Personalized customer experience using ecommerce portalPersonalized customer experience using ecommerce portal
Personalized customer experience using ecommerce portalZyxware Technologies
 
Web Application Performance Audit and Optimization
Web Application Performance Audit and OptimizationWeb Application Performance Audit and Optimization
Web Application Performance Audit and OptimizationZyxware Technologies
 
Setting in place a product development strategy
Setting in place a product development strategySetting in place a product development strategy
Setting in place a product development strategyZyxware Technologies
 
Debugging Drupal - How to Debug your Drupal Application
Debugging Drupal - How to Debug your Drupal ApplicationDebugging Drupal - How to Debug your Drupal Application
Debugging Drupal - How to Debug your Drupal ApplicationZyxware Technologies
 
Drupal Performance Audit and Optimization
Drupal Performance Audit and OptimizationDrupal Performance Audit and Optimization
Drupal Performance Audit and OptimizationZyxware Technologies
 
Drupal as a Rapid Application Development Framework for Non Profits / NGOs
Drupal as a Rapid Application Development Framework for Non Profits / NGOsDrupal as a Rapid Application Development Framework for Non Profits / NGOs
Drupal as a Rapid Application Development Framework for Non Profits / NGOsZyxware Technologies
 
An introduction to cyber forensics and open source tools in cyber forensics
An introduction to cyber forensics and open source tools in cyber forensicsAn introduction to cyber forensics and open source tools in cyber forensics
An introduction to cyber forensics and open source tools in cyber forensicsZyxware Technologies
 
Exploring Wider Collaboration Mechanisms in the Drupal Space
Exploring Wider Collaboration Mechanisms in the Drupal SpaceExploring Wider Collaboration Mechanisms in the Drupal Space
Exploring Wider Collaboration Mechanisms in the Drupal SpaceZyxware Technologies
 
The art of communication - managing digital communication
The art of communication - managing digital communicationThe art of communication - managing digital communication
The art of communication - managing digital communicationZyxware Technologies
 
Code quality - aesthetics & functionality of writing beautiful code
Code quality - aesthetics & functionality of writing beautiful codeCode quality - aesthetics & functionality of writing beautiful code
Code quality - aesthetics & functionality of writing beautiful codeZyxware Technologies
 
Drupal ecosystem in India and Drupal's market potential in India
Drupal ecosystem in India and Drupal's market potential in IndiaDrupal ecosystem in India and Drupal's market potential in India
Drupal ecosystem in India and Drupal's market potential in IndiaZyxware Technologies
 
Drupal as a Rapid Application Development (RAD) Framework for Startups
Drupal as a Rapid Application Development (RAD) Framework for StartupsDrupal as a Rapid Application Development (RAD) Framework for Startups
Drupal as a Rapid Application Development (RAD) Framework for StartupsZyxware Technologies
 
Collaborative development using git, Session conducted at Model Engineering C...
Collaborative development using git, Session conducted at Model Engineering C...Collaborative development using git, Session conducted at Model Engineering C...
Collaborative development using git, Session conducted at Model Engineering C...Zyxware Technologies
 
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26Zyxware Technologies
 
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...Zyxware Technologies
 
ICFOSS Interaction with Small and Medium Enterprises on IT Enabling SMEs with...
ICFOSS Interaction with Small and Medium Enterprises on IT Enabling SMEs with...ICFOSS Interaction with Small and Medium Enterprises on IT Enabling SMEs with...
ICFOSS Interaction with Small and Medium Enterprises on IT Enabling SMEs with...Zyxware Technologies
 

Mais de Zyxware Technologies (20)

Google Docs - Leverage the power of collaboration with shared documents
Google Docs - Leverage the power of collaboration with shared documentsGoogle Docs - Leverage the power of collaboration with shared documents
Google Docs - Leverage the power of collaboration with shared documents
 
CETAA Vision 2025 - Making CETAA the best alumni association in India
CETAA Vision 2025 - Making CETAA the best alumni association in IndiaCETAA Vision 2025 - Making CETAA the best alumni association in India
CETAA Vision 2025 - Making CETAA the best alumni association in India
 
Come, build your career at Zyxware Technologies
Come, build your career at Zyxware TechnologiesCome, build your career at Zyxware Technologies
Come, build your career at Zyxware Technologies
 
Personalized customer experience using ecommerce portal
Personalized customer experience using ecommerce portalPersonalized customer experience using ecommerce portal
Personalized customer experience using ecommerce portal
 
Web Application Performance Audit and Optimization
Web Application Performance Audit and OptimizationWeb Application Performance Audit and Optimization
Web Application Performance Audit and Optimization
 
Drupal is taking over Australia
Drupal is taking over AustraliaDrupal is taking over Australia
Drupal is taking over Australia
 
Setting in place a product development strategy
Setting in place a product development strategySetting in place a product development strategy
Setting in place a product development strategy
 
Debugging Drupal - How to Debug your Drupal Application
Debugging Drupal - How to Debug your Drupal ApplicationDebugging Drupal - How to Debug your Drupal Application
Debugging Drupal - How to Debug your Drupal Application
 
Drupal Performance Audit and Optimization
Drupal Performance Audit and OptimizationDrupal Performance Audit and Optimization
Drupal Performance Audit and Optimization
 
Drupal as a Rapid Application Development Framework for Non Profits / NGOs
Drupal as a Rapid Application Development Framework for Non Profits / NGOsDrupal as a Rapid Application Development Framework for Non Profits / NGOs
Drupal as a Rapid Application Development Framework for Non Profits / NGOs
 
An introduction to cyber forensics and open source tools in cyber forensics
An introduction to cyber forensics and open source tools in cyber forensicsAn introduction to cyber forensics and open source tools in cyber forensics
An introduction to cyber forensics and open source tools in cyber forensics
 
Exploring Wider Collaboration Mechanisms in the Drupal Space
Exploring Wider Collaboration Mechanisms in the Drupal SpaceExploring Wider Collaboration Mechanisms in the Drupal Space
Exploring Wider Collaboration Mechanisms in the Drupal Space
 
The art of communication - managing digital communication
The art of communication - managing digital communicationThe art of communication - managing digital communication
The art of communication - managing digital communication
 
Code quality - aesthetics & functionality of writing beautiful code
Code quality - aesthetics & functionality of writing beautiful codeCode quality - aesthetics & functionality of writing beautiful code
Code quality - aesthetics & functionality of writing beautiful code
 
Drupal ecosystem in India and Drupal's market potential in India
Drupal ecosystem in India and Drupal's market potential in IndiaDrupal ecosystem in India and Drupal's market potential in India
Drupal ecosystem in India and Drupal's market potential in India
 
Drupal as a Rapid Application Development (RAD) Framework for Startups
Drupal as a Rapid Application Development (RAD) Framework for StartupsDrupal as a Rapid Application Development (RAD) Framework for Startups
Drupal as a Rapid Application Development (RAD) Framework for Startups
 
Collaborative development using git, Session conducted at Model Engineering C...
Collaborative development using git, Session conducted at Model Engineering C...Collaborative development using git, Session conducted at Model Engineering C...
Collaborative development using git, Session conducted at Model Engineering C...
 
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26
 
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...
 
ICFOSS Interaction with Small and Medium Enterprises on IT Enabling SMEs with...
ICFOSS Interaction with Small and Medium Enterprises on IT Enabling SMEs with...ICFOSS Interaction with Small and Medium Enterprises on IT Enabling SMEs with...
ICFOSS Interaction with Small and Medium Enterprises on IT Enabling SMEs with...
 

Último

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
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
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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
 
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
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
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
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 

Último (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
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
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
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
 
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
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
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
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 

Learn Drupal 8 Render Pipeline

  • 1. The Drupal 8 Render Pipeline Anish M. M. Adrian McDonald Tariang Summer Interns Date: 2017-06-08 From Request to Response
  • 2. Introduction In order to generate a response for a request, Drupal performs a sequence of steps, called the Drupal Render Pipeline. In the following slides, we will go through these steps one by one.
  • 5. 1.The Front Controller[index.php] This is the entry point of execution where Drupal creates the Request Object from the HTTP request, processes it and and returns the response back to the browser.
  • 6. 1.The Front Controller[index.php] Key Components HttpFoundation Component of Symfony that creates an object- oriented layer from the superglobals of the PHP request. HttpKernel Another Symfony component used to provide a structured pipeline to render a response for the Drupal System.
  • 7. Loads all the dependencies using the autoload.php file. Instantiates the DrupalKernel class. Creates a $request object of Symfony’s Request class from the component HttpFoundation. Calls the DrupalKernel::handle() method and passes the $request object as argument. 1.The Front Controller[index.php] Steps Followed
  • 8. DrupalKernel::handle() This handle() method : Calls DrupalKernel::bootEnvironment() - which sets the PHP environment variables that need to be set to ensure security. Calls DrupalKernel::initializeSettings() which locates site path and initializes the Drupal settings. Calls HttpKernel::handle() method which is a part of the Symfony component HttpKernel.
  • 10. Events, Event Listeners. An event is like a notice on a bulletin board. Event Listeners are the people who wait (‘listen’) for a notice. Listeners listen for a particular kind of event, say, for a kernel.exception event. Dispatching an event is like putting it on the notice board. When the event they are listening to is dispatched, they check whether they can perform the required action. If so, they respond to the dispatched event using the setResponse() method and stops the propagation of the event.
  • 11. REQUEST event During this event, exceptions could occur which could run its own controller (see kernel.exception) and send back a response. The first event in the kernel.handle() method. Subscribers to the request event perform task such as: 1. Format negotiation of the response data i.e. html, json. 2. Controller selection to handle the request.
  • 12. REQUEST event Subscribers in order of execution
  • 13. Routing Drupal’s routing system is responsible for providing an appropriate controller to a requested path. It is based on the Symfony component Routing, which uses routes.yml files present in the module directory to map the routes to controllers. The route file contains data such as the format the response is to be produced, the controller to be used, security requirements and other supporting data.
  • 14. RouteBuilder::rebuild() building the route information This workflow represents how the routes are loaded from the modules’ routing.yml files and other sources into the Drupal database.
  • 15. Routing The controller performs the business logic for the application. The routing.yml file contains one of these “controller” types: _content _controller _form _entity[_form | _view | _list] Which specify how the output is generated. This data is then set into the request attributes.
  • 16. Routing Example In this example, during the request event, if the URL request is as specified in `path`, the controller defined at `_form` is to be used to provide the given menu form. This YAML file also specifies that the client needs to be logged in to access the page. colorbox.routing.yml file to the Colorbox module. An example request:
  • 17. Controller Resolution Now, the handle() method is required to select the exact Controller using the request attributes that was set by the routing Component. This is performed using the getController() method of a class implementing the ControllerResolverInterface of the Symfony component HttpKernel.
  • 18. Resolving Controller Parameters The given section is used to provide an array of arguments for the Controller to operate. This is performed by the Drupal System and may even include the entire request object if required.
  • 19. CONTROLLER event During this event, subscribers or listeners perform initialization or testing before the controller is allowed to be executed. The Listeners also have the privilege to change the Controller to be used if required.
  • 20. Resolving Controller Parameters The given section is used to provide an array of arguments for the Controller to operate. This is performed by the Drupal System and may even include the entire request object if required.
  • 21. Calling the controller The selected controller is now called by handle() with its arguments. The Drupal controllers return either: The Response Object Render Array or other objects. If the controller returns a response object, it moves directly to the response event without going through the view event. Render arrays and other objects are converted into Response objects through the listeners of the view event, which is dispatched after controller completion.
  • 22. VIEW event Listeners to this event, also called View Subscribers, convert render arrays and objects into Response objects by delegating the task to specified renderers to a given format. (html, json, xml). Listeners, can also use templates to provide the response object in the specified format.
  • 23. Render Arrays Example: Render Array HTML Output Through a Content Renderer
  • 24. Render Arrays A render array is a classic Drupal structured array that provides data (probably nested) along with hints as to how it should be rendered (properties like #type). Modules have the capability of defining “elements”, which are essentially prepackaged default render arrays. They use hook_element_info() to do this. When #type is declared for a render array, the default properties of the element type named are loaded through the use of hook_element_info().
  • 25. Render Arrays They allow the modules to treat the content as data for as long as possible in the page generation process.
  • 26. MainContentViewSubscriber This view subscriber converts Render Arrays into Response objects. It checks whether a maincontent renderer service for the requested response format exists. If it does, it is initialized. Else, a 406 (Not Acceptable) response is generated. Other objects may be converted by corresponding view subscribers on seeing the kernel.view event, either directly into Response objects, or into Render Arrays. In the latter case, the MainContentViewSubscriber converts it into a Response object.
  • 27. RESPONSE event During the event, final modifications are performed over the Response object such as inserting javascripts or cookies. Placeholders in the Response object are replaced through Placeholder Strategies such as BigPipe and SingleFlush. It is after this event that the Response is sent back to the Front controller through the handle() method.
  • 28. SingleFlush vs BigPipe Caching Cache, in computing, is a component that stores frequently used data so that future requests for that data can be served faster. Frequently used / common data can be cached and loaded faster, while dynamic / personalized data is generated. In Drupal 8, Caching is performed through cache- tags, cache-contexts and max-age.
  • 29. SingleFlush vs BigPipe By default, responses to requests are delivered in a SingleFlush method. The server generates all the content to be displayed and then dumps it to the browser screen. So, entire pages are cache-able, but not as parts of one. Here, the perceived time for loading the web page is more and user has to sometimes stare at a white screen till the full page loads.
  • 30. SingleFlush vs BigPipe An alternative to SingleFlush, is the BigPipe method. Here, the pages are sent in a way which allows the browser to display them much faster. Caching of parts of pages is possible. So, the cached parts are displayed and then the dynamic parts are added as and when received. The total time for loading the page may be the same, but the perceived time is lesser. Also, the user is provided with some workable content before the whole page is loaded.
  • 31. TERMINATE event This event is triggered after the Response object is already sent back to the client. Used to perform slower tasks such as system logging and sending emails which now would not increase response time. This is made possible by the TerminableInterface provided by the Symfony component HttpKernel.
  • 32. EXCEPTION event Triggered to handle exceptions and tailor appropriate responses to the client. For example, if the client does not have sufficient permissions or if the requested data does not exist. An exception is also thrown when no listeners to events such as request and view are triggered.
  • 33. References Site Point: From Request to Response Drupal Render API Documentation Drupal 8 Render Pipeline talk Symfony 2 HttpKernel Component Drupal API Documentation Drupal Cache API Documentation Credits Wim Leers, author to material such as the render pipeline diagram and the DrupalCon talk, which have been used extensively in this presentation. Images taken from symfony.com/docs
  • 34. Contact Zyxware Website: http://www.zyxware.com Email : drupal@zyxware.com Phone : +91-8606011184