You are here

class UpdateOptionsCommand in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Ajax/UpdateOptionsCommand.php \Drupal\business_rules\Ajax\UpdateOptionsCommand

Ajax command to update form options.

@package Drupal\business_rules\Ajax

Hierarchy

Expanded class hierarchy of UpdateOptionsCommand

1 file declares its use of UpdateOptionsCommand
BusinessRulesViewsSelection.php in src/Plugin/EntityReferenceSelection/BusinessRulesViewsSelection.php

File

src/Ajax/UpdateOptionsCommand.php, line 12

Namespace

Drupal\business_rules\Ajax
View source
class UpdateOptionsCommand implements CommandInterface {
  protected $elementId;
  protected $options;
  protected $formatter;

  /**
   * UpdateOptionsCommand constructor.
   *
   * @param string $elementId
   *   The element html id.
   * @param array $options
   *   The element options [key, value].
   * @param string $formatter
   *   The field formatter.
   */
  public function __construct($elementId, array $options, $formatter) {
    $this->elementId = $elementId;
    $this->options = $options;
    $this->formatter = $formatter;
  }

  /**
   * {@inheritdoc}
   */
  public function render() {
    return [
      'command' => 'updateOptionsCommand',
      'method' => 'html',
      'elementId' => $this->elementId,
      'options' => $this->options,
      'formatter' => $this->formatter,
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
UpdateOptionsCommand::$elementId protected property
UpdateOptionsCommand::$formatter protected property
UpdateOptionsCommand::$options protected property
UpdateOptionsCommand::render public function Return an array to be run through json_encode and sent to the client. Overrides CommandInterface::render
UpdateOptionsCommand::__construct public function UpdateOptionsCommand constructor.