function AjaxResponseAttachmentsProcessor::processAttachments
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.php \Drupal\Core\Ajax\AjaxResponseAttachmentsProcessor::processAttachments()
- 8.9.x core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.php \Drupal\Core\Ajax\AjaxResponseAttachmentsProcessor::processAttachments()
- 11.x core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.php \Drupal\Core\Ajax\AjaxResponseAttachmentsProcessor::processAttachments()
Processes the attachments of a response that has attachments.
Placeholders need to be rendered first in order to have all attachments available for processing. For an example, see \Drupal\Core\Render\HtmlResponseAttachmentsProcessor::renderPlaceholders()
Parameters
\Drupal\Core\Render\AttachmentsInterface $response: The response to process.
Return value
\Drupal\Core\Render\AttachmentsInterface The processed response, with the attachments updated to reflect their final values.
Overrides AttachmentsResponseProcessorInterface::processAttachments
File
-
core/
lib/ Drupal/ Core/ Ajax/ AjaxResponseAttachmentsProcessor.php, line 111
Class
- AjaxResponseAttachmentsProcessor
- Processes attachments of AJAX responses.
Namespace
Drupal\Core\AjaxCode
public function processAttachments(AttachmentsInterface $response) {
assert($response instanceof AjaxResponse, '\\Drupal\\Core\\Ajax\\AjaxResponse instance expected.');
$request = $this->requestStack
->getCurrentRequest();
if ($response->getContent() == '{}') {
$response->setData($this->buildAttachmentsCommands($response, $request));
}
return $response;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.