learnosity-1.0.x-dev/src/Ajax/LearnosityErrorCommand.php
src/Ajax/LearnosityErrorCommand.php
<?php
namespace Drupal\learnosity\Ajax;
use Drupal\Core\Ajax\CommandInterface;
/**
* Ajax command for polling learnosity.
*
* During some event you may want to instruct learnosity.init.js to deliver
* an error response.
*
* @ingroup ajax
*/
class LearnosityErrorCommand implements CommandInterface {
/**
* The error message.
*
* @var string
*/
protected $message;
/**
* LearnosityErrorCommand constructor.
*
* @param string $message
* The error message.
*/
public function __construct($message) {
$this->message = $message;
}
/**
* {@inheritdoc}
*/
public function render() {
return [
'command' => 'learnosityError',
'message' => $this->message,
];
}
}
