function AttachedAssets::createFromRenderArray
Overrides AttachedAssetsInterface::createFromRenderArray
3 calls to AttachedAssets::createFromRenderArray()
- BigPipe::sendContent in core/
modules/ big_pipe/ src/ Render/ BigPipe.php - Sends an HTML response in chunks using the BigPipe technique.
- CommandWithAttachedAssetsTrait::getRenderedContent in core/
lib/ Drupal/ Core/ Ajax/ CommandWithAttachedAssetsTrait.php - Processes the content for output.
- HtmlResponseAttachmentsProcessor::processAttachments in core/
lib/ Drupal/ Core/ Render/ HtmlResponseAttachmentsProcessor.php - Processes the attachments of a response that has attachments.
File
-
core/
lib/ Drupal/ Core/ Asset/ AttachedAssets.php, line 34
Class
- AttachedAssets
- The default attached assets collection.
Namespace
Drupal\Core\AssetCode
public static function createFromRenderArray(array $render_array) {
if (!isset($render_array['#attached'])) {
throw new \LogicException('The render array has not yet been rendered, hence not all attachments have been collected yet.');
}
$assets = new static();
if (isset($render_array['#attached']['library'])) {
$assets->setLibraries($render_array['#attached']['library']);
}
if (isset($render_array['#attached']['drupalSettings'])) {
$assets->setSettings($render_array['#attached']['drupalSettings']);
}
return $assets;
}