Produced by OmniGraffle 6.0.3 2014-10-29 19:56ZCanvas 1Layer 1Example: GET /admin.HTTP request1. The kernel.request eventDetermine matching routeHTTP responseNegotiate formatRequest handling and rendering flowExample: /admin path system.admin routeThat route has the following attributes: _content: '\D\s\C\SystemController::systemAdminMenuBlockPage' _title: ‘Administration’Explanation2. renderResponse()Select page display variantIs a#type ‘page’ render array?KernelEvents::REQUESThook_page_attachments()hook_page_(top|bottom)()Example: BlockPageVariant selected.drupal_render() formain contentYesNoBuild page display variantThe result of a built page display variant is a #type ‘page’ render array.hook_page_attachments() operates on #type ‘page’.The main content must already be rendered, because it might set thepage title.drupal_render() of entire HTML documentOnly accepts render arrays of #type ‘page’!Wrap in #type ‘html’hook_page_top() and hook_page_bottom() operate on #type ‘html’.Example: response for the path /admin.Renders the 3 parts of the HTML body: page_top, page, page_bottom(where page corresponds to #type ‘page’ and hence page.html.twig).Then renders the entire HTML (i.e. the html.html.twig template).drupal_render() formain contentAdd InsertCommandnew AjaxResponse()Get dialog options from RequestCalculate title if not provided by main contentCalculate title if not provided by main contentdrupal_render() formain contentAdd OpenDialogCmdnew AjaxResponse()The flow for all four formats supported in core in their respect isdisplayed next, but the explanations below only apply to theHtmlController!If an unsupported format was negotiated, a 406 response is generated. new Response()2. Resolve the Controller3. The kernel.controller eventSee http://symfony.com/doc/2.5/components/http_kernel/introduction.html for more details — this shows the same steps.4. Getting the Controller Arguments5. Calling the Controller6. The kernel.view Event7. The kernel.response EventDialogRendererModalRendererHtmlRendererAjaxRendererIs Response?NoYesSet _controllerindex.php3. Call Response::prepare()Response2. Call HttpKernel::handle()1. Create Request from globals4. Call Response::send()5. Call HttpKernel::terminate()HttpKernel::handle()Initialize the corresponding main content rendererIs render array?YesMain content renderer for request format exists?YesCall ::renderResponse()Set Response on EventGenerate 406 ResponseNoKernelEvents::VIEWController returns either:- a Response- a render array- a domain objectSymfony (HttpKernel)Drupal (Controller, MainContentViewSubscriber, main content renderers)Event handlingNo1. prepare() helperCalculate title if not provided by main contentdrupal_render() formain contentAdd OpenModalDialogCmdnew AjaxResponse()KernelEvents::CONTROLLERformat = ‘ajax’format = ‘modal’SystemEvents:SELECT_PAGE_DISPLAY_VARIANTKernelEvents::RESPONSEKernelEvents::TERMINATESome parts are greyed out because they’re of lesser importance: they do happen, but are not crucial for understanding the flow.MainContentViewSubscriberResponseResponseResponsemain content renderersformat = ‘html’format = ‘dialog’Typically, the format will be html, but it could also beajax, dialog, modal, json, hal_json, and more. See: Symfony’s Request::setFormat()._controller is set to '\D\s\C\SystemController::systemAdminMenuBlockPage'\D\s\C\SystemController::systemAdminMenuBlockPage is called, itreturns a render array with no #type.MainContentViewSubscriber only handles render arrays!If it’s anything else (e.g. a domain object), then it’s up toanother VIEW event subscriber to turn it into a Response.MainContentViewSubscriber looks at the available main contentrenderer services. These are tagged with render.main_content_renderer.Contributed modules can additional renderers.