protected function EntityView::gatherAssetMarkup in Services 9.0.x
Same name and namespace in other branches
- 8.4 src/Plugin/ServiceDefinition/EntityView.php \Drupal\services\Plugin\ServiceDefinition\EntityView::gatherAssetMarkup()
Gathers the markup for each type of asset.
@todo template_preprocess_html() should be split up and made reusable.
Parameters
array $render_array: The render array for the entity.
Return value
array An array of rendered assets. See self::getRenderedEntity() for the keys.
1 call to EntityView::gatherAssetMarkup()
- EntityView::processRequest in src/
Plugin/ ServiceDefinition/ EntityView.php - Processes the request and returns an array of data as appropriate.
File
- src/
Plugin/ ServiceDefinition/ EntityView.php, line 114
Class
- EntityView
- Plugin annotation @ServiceDefinition( id = "entity_view", methods = { "GET" }, translatable = true, deriver = "\Drupal\services\Plugin\Deriver\EntityView" )
Namespace
Drupal\services\Plugin\ServiceDefinitionCode
protected function gatherAssetMarkup(array $render_array) {
$assets = AttachedAssets::createFromRenderArray($render_array);
// Render the asset collections.
$css_assets = $this->assetResolver
->getCssAssets($assets, FALSE);
$variables['styles'] = $this->cssCollectionRenderer
->render($css_assets);
list($js_assets_header, $js_assets_footer) = $this->assetResolver
->getJsAssets($assets, FALSE);
$variables['scripts'] = $this->jsCollectionRenderer
->render($js_assets_header);
$variables['scripts_bottom'] = $this->jsCollectionRenderer
->render($js_assets_footer);
// @todo Handle all non-asset attachments.
// $variables['head'] = drupal_get_html_head(FALSE);
return $variables;
}