class FireJavascriptCommand in Maestro 8.2
Same name and namespace in other branches
- 3.x modules/maestro_template_builder/src/Ajax/FireJavascriptCommand.php \Drupal\maestro_template_builder\Ajax\FireJavascriptCommand
An AJAX command for calling our own javascript functions/methods.
Hierarchy
- class \Drupal\maestro_template_builder\Ajax\FireJavascriptCommand implements CommandInterface
Expanded class hierarchy of FireJavascriptCommand
5 files declare their use of FireJavascriptCommand
- MaestroTemplateBuilderAddNew.php in modules/
maestro_template_builder/ src/ Form/ MaestroTemplateBuilderAddNew.php - MaestroTemplateBuilderCanvas.php in modules/
maestro_template_builder/ src/ Form/ MaestroTemplateBuilderCanvas.php - MaestroTemplateBuilderEditTask.php in modules/
maestro_template_builder/ src/ Form/ MaestroTemplateBuilderEditTask.php - MaestroTemplateBuilderForm.php in modules/
maestro_template_builder/ src/ Form/ MaestroTemplateBuilderForm.php - MaestroValidityCheck.php in modules/
maestro_template_builder/ src/ Form/ MaestroValidityCheck.php
File
- modules/
maestro_template_builder/ src/ Ajax/ FireJavascriptCommand.php, line 12
Namespace
Drupal\maestro_template_builder\AjaxView source
class FireJavascriptCommand implements CommandInterface {
/**
* The Function to call in our maestro template. Please see
* template-display.js and find the declaration for
* Drupal.AjaxCommands.prototype.addNewTask as an example of a javascript callback.
*
* @var string
*/
protected $function;
/**
* Keyed array of the values we want to pass back.
* We cycle through these values and create the final return structure.
*
* @var array
*/
protected $values;
/**
* Constructs a our FireMaestroCommand.
*
* @param string $function
* The javascript function you wish to call.
* @param array $values
* Keyed array of values you wish to pass back to the javascript function being called.
*/
public function __construct($function, array $values) {
$this->function = $function;
$this->values = $values;
}
/**
* Implements Drupal\Core\Ajax\CommandInterface:render().
*/
public function render() {
$ret = [];
$ret['command'] = $this->function;
foreach ($this->values as $key => $val) {
$ret[$key] = $val;
}
return $ret;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FireJavascriptCommand:: |
protected | property | The Function to call in our maestro template. Please see template-display.js and find the declaration for Drupal.AjaxCommands.prototype.addNewTask as an example of a javascript callback. | |
FireJavascriptCommand:: |
protected | property | Keyed array of the values we want to pass back. We cycle through these values and create the final return structure. | |
FireJavascriptCommand:: |
public | function |
Implements Drupal\Core\Ajax\CommandInterface:render(). Overrides CommandInterface:: |
|
FireJavascriptCommand:: |
public | function | Constructs a our FireMaestroCommand. |