// Print styles - if present.
if (isset($placeholders['styles'
])) { // Optimize CSS if necessary, but only during normal site operation.
$optimize_css = !
$maintenance_mode &&
$this->config->
get('css.preprocess'
);
$variables['styles'
] =
$this->cssCollectionRenderer->
render($this->assetResolver->
getCssAssets($assets,
$optimize_css,
$this->languageManager->
getCurrentLanguage()));
} // Print scripts - if any are present.
if (isset($placeholders['scripts'
]) ||
isset($placeholders['scripts_bottom'
])) { // Optimize JS if necessary, but only during normal site operation.
$optimize_js = !
$maintenance_mode &&
$this->config->
get('js.preprocess'
);
[$js_assets_header,
$js_assets_footer] =
$this->assetResolver->
getJsAssets($assets,
$optimize_js,
$this->languageManager->
getCurrentLanguage());
$variables['scripts'
] =
$this->jsCollectionRenderer->
render($js_assets_header);
$variables['scripts_bottom'
] =
$this->jsCollectionRenderer->
render($js_assets_footer);
} return $variables;
} /**
* Renders HTML response attachment placeholders.
*
* This is the last step where all of the attachments are placed into the
* response object's contents.
*
* @param \Drupal\Core\Render\HtmlResponse $response
* The HTML response to update.
* @param array $placeholders
* An array of placeholders, keyed by type with the placeholders
* present in the content of the response as values.
* @param array $variables
* The variables to render and replace, keyed by type with renderable
* arrays as values.
*/