AjaxResponseAttachmentsProcessor
class AjaxResponseAttachmentsProcessor implements AttachmentsResponseProcessorInterface (View source)
Processes attachments of AJAX responses.
Properties
| protected AssetResolverInterface | $assetResolver | The asset resolver service. |
|
| protected Config | $config | A config object for the system performance configuration. |
|
| protected AssetCollectionRendererInterface | $cssCollectionRenderer | The CSS asset collection renderer service. |
|
| protected AssetCollectionRendererInterface | $jsCollectionRenderer | The JS asset collection renderer service. |
|
| protected RequestStack | $requestStack | The request stack. |
|
| protected RendererInterface | $renderer | The renderer. |
|
| protected ModuleHandlerInterface | $moduleHandler | The module handler. |
Methods
Constructs an AjaxResponseAttachmentsProcessor object.
Processes the attachments of a response that has attachments.
Prepares the AJAX commands to attach assets.
Details
__construct(AssetResolverInterface $asset_resolver, ConfigFactoryInterface $config_factory, AssetCollectionRendererInterface $css_collection_renderer, AssetCollectionRendererInterface $js_collection_renderer, RequestStack $request_stack, RendererInterface $renderer, ModuleHandlerInterface $module_handler)
Constructs an AjaxResponseAttachmentsProcessor object.
AttachmentsInterface
processAttachments(AttachmentsInterface $response)
Processes the attachments of a response that has attachments.
Libraries, JavaScript settings, feeds, HTML
tags, HTML links, HTTP headers, and the HTTP status code are attached to render arrays using the #attached property. The #attached property is an associative array, where the keys are the attachment types and the values are the attached data. For example:
protected array
buildAttachmentsCommands(AjaxResponse $response, Request $request)
Prepares the AJAX commands to attach assets.