Chris@0: commands, $command->render()); Chris@0: } Chris@0: else { Chris@0: $this->commands[] = $command->render(); Chris@0: } Chris@0: if ($command instanceof CommandWithAttachedAssetsInterface) { Chris@0: $assets = $command->getAttachedAssets(); Chris@0: $attachments = [ Chris@0: 'library' => $assets->getLibraries(), Chris@0: 'drupalSettings' => $assets->getSettings(), Chris@0: ]; Chris@0: $attachments = BubbleableMetadata::mergeAttachments($this->getAttachments(), $attachments); Chris@0: $this->setAttachments($attachments); Chris@0: } Chris@0: Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets all AJAX commands. Chris@0: * Chris@0: * @return \Drupal\Core\Ajax\CommandInterface[] Chris@0: * Returns all previously added AJAX commands. Chris@0: */ Chris@0: public function &getCommands() { Chris@0: return $this->commands; Chris@0: } Chris@0: Chris@0: }