renderBodyEndHtml() protected method

The content is rendered using the registered JS code blocks and files.
protected renderBodyEndHtml ( boolean $ajaxMode ) : string
$ajaxMode boolean whether the view is rendering in AJAX mode. If true, the JS scripts registered at [[POS_READY]] and [[POS_LOAD]] positions will be rendered at the end of the view like normal scripts.
return string the rendered content
Example #1
0
 /**
  * @inheritdoc
  */
 protected function renderBodyEndHtml($ajaxMode)
 {
     $this->getJsData();
     $lines = parent::renderBodyEndHtml($ajaxMode);
     $paths = $this->getRequireJsPaths();
     $requireJsConfig = $this->getRequireJsConfig($paths);
     $jsCode = $this->getRequireJsCode();
     $lines = "<script type=\"text/javascript\">var require = {$requireJsConfig};</script>\n" . $lines;
     $modulesJsArray = json_encode(array_keys($paths));
     $lines .= "<script type=\"text/javascript\">require(['jquery'], function() { require({$modulesJsArray}, function() { {$jsCode} }); });</script>\n";
     return $lines;
 }