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