Skip to content
Snippets Groups Projects

Resolve #3397446 "Attach library with command"

3 files
+ 22
12
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -3,11 +3,13 @@
namespace Drupal\ajax_command_page_reload\Ajax;
use Drupal\Core\Ajax\CommandInterface;
use Drupal\Core\Ajax\CommandWithAttachedAssetsInterface;
use Drupal\Core\Asset\AttachedAssets;
/**
* Trigger "window.location.reload()" within the frontend.
*/
class PageReloadCommand implements CommandInterface {
class PageReloadCommand implements CommandInterface, CommandWithAttachedAssetsInterface {
/**
* {@inheritdoc}
@@ -18,4 +20,13 @@ class PageReloadCommand implements CommandInterface {
];
}
/**
* {@inheritdoc}
*/
public function getAttachedAssets() {
$assets = new AttachedAssets();
$assets->setLibraries(['ajax_command_page_reload/ajax_commands']);
return $assets;
}
}
Loading