Produced by OmniGraffle 6.0.3 2014-10-24 16:53ZCanvas 1Layer 1Example: request for the path /admin.RequestHttpKernel::handle()Determine matching routeIs _controller route?_controller returns ResponseResponseYes_content returns render arrayNegotiate formatRequest handling and rendering flowEvent handlingDetermine controllerMain content controllers in core, for corresponding formats:- main_content_controller.html- main_content_controller.ajax- main_content_controller.dialog- main_content_controller.modalContentControllerSubscriberNo“No” means only “main content” (a render array) will be returned.(Typically from a _content route.)Format that the main content will be rendered in.Available formats in core: html, ajax, dialog, modal.See: Symfony’s Request::setFormat().Example: /admin path system.admin routeThat route has the following attributes: _content: '\D\s\C\SystemController::systemAdminMenuBlockPage' _title: ‘Administration’Explanation_content_controllerExample: system.admin route, calls \Dl\s\C\SystemController::systemAdminMenuBlockPage' because that’s in its _content attribute.1. ::getMainContent()2. ::prepareContent()3. ::renderContentIntoResponse()Select page display variantHtmlController::handle()Is #type ‘page’ render array?KernelEvents::REQUEST eventSELECT_PAGE_DISPLAY_VARIANT eventhook_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!Only 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)._content returns render array1. ::getMainContent()2. ::prepareContent()3. ::renderContentIntoResponse()_content returns render array1. ::getMainContent()2. ::prepareContent()3. ::renderContentIntoResponse()_content returns render array1. ::getMainContent()2. ::prepareContent()3. ::renderContentIntoResponse()format = ‘html’AjaxController::handle()format = ‘ajax’ModalController::handle()format = ‘modal’DialogController::handle()format = ‘dialog’Pass through!drupal_render() formain contentInsertCommandnew AjaxResponse()Get dialog options from RequestCalculate title if not provided by main contentCalculate title if not provided by main contentdrupal_render() formain contentOpenDialogCommandnew AjaxResponse()drupal_render() formain contentOpenModalDialogComdnew AjaxResponse()Get dialog options from RequestCalculate title if not provided by main contentThe flow for all four formats supported in core in their respect isdisplayed next, but the explanations below only apply to theHtmlController!new Response()AjaxResponse::prepare()AjaxResponse::prepare()AjaxResponse::prepare()