Repository URL to install this package:
|
Version:
2.0.1 ▾
|
<?php
namespace Drupal\dds\Ajax;
use Drupal\Core\Ajax\CommandInterface;
class SpinnerCommand implements CommandInterface {
protected $commands = ['show' => 'showSpinner', 'hide' => 'hideSpinner'];
private $selector;
private $command;
public function __construct($selector, $command) {
$this->selector = $selector;
$this->command = (isset($this->commands[$command]) ? $this->commands[$command] : '');
}
public function render() {
$spinner_template = [
'#theme' => 'dds_spinner',
];
return [
'command' => $this->command,
'selector' => $this->selector,
'template' => render($spinner_template),
];
}
}