You are here

class JsAttachmentsProcessor in JS Callback Handler 8.3

Processes attachments of AJAX responses.

Hierarchy

Expanded class hierarchy of JsAttachmentsProcessor

See also

\Drupal\Core\Ajax\AjaxResponse

\Drupal\Core\Render\MainContent\AjaxRenderer

1 string reference to 'JsAttachmentsProcessor'
js.services.yml in ./js.services.yml
js.services.yml
1 service uses JsAttachmentsProcessor
js.attachments_processor in ./js.services.yml
Drupal\js\JsAttachmentsProcessor

File

src/JsAttachmentsProcessor.php, line 14

Namespace

Drupal\js
View source
class JsAttachmentsProcessor extends AjaxResponseAttachmentsProcessor {

  /**
   * {@inheritdoc}
   */
  public function processAttachments(AttachmentsInterface $response) {
    assert('$response instanceof \\Drupal\\js\\JsResponse');

    /** @var \Drupal\js\JsResponse $response */
    $data = $response
      ->getData();
    if (!isset($data['commands'])) {
      $data['commands'] = [];
    }
    $data['commands'] = array_merge($data['commands'], $this
      ->buildAttachmentsCommands($response, $this->requestStack
      ->getCurrentRequest()));
    $response
      ->setData($data);
    return $response;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AjaxResponseAttachmentsProcessor::$assetResolver protected property The asset resolver service.
AjaxResponseAttachmentsProcessor::$config protected property A config object for the system performance configuration.
AjaxResponseAttachmentsProcessor::$cssCollectionRenderer protected property The CSS asset collection renderer service.
AjaxResponseAttachmentsProcessor::$jsCollectionRenderer protected property The JS asset collection renderer service.
AjaxResponseAttachmentsProcessor::$moduleHandler protected property The module handler.
AjaxResponseAttachmentsProcessor::$renderer protected property The renderer.
AjaxResponseAttachmentsProcessor::$requestStack protected property The request stack.
AjaxResponseAttachmentsProcessor::buildAttachmentsCommands protected function Prepares the AJAX commands to attach assets.
AjaxResponseAttachmentsProcessor::__construct public function Constructs a AjaxResponseAttachmentsProcessor object.
JsAttachmentsProcessor::processAttachments public function Processes the attachments of a response that has attachments. Overrides AjaxResponseAttachmentsProcessor::processAttachments