class SetFormCommand

Provides an AJAX command for setting a form in the views edit modal.

This command is implemented in Drupal.AjaxCommands.prototype.viewsSetForm.

Hierarchy

Expanded class hierarchy of SetFormCommand

1 file declares its use of SetFormCommand
ajax.inc in drupal/core/modules/views/includes/ajax.inc
Handles the server side AJAX interactions of Views.

File

drupal/core/modules/views/lib/Drupal/views/Ajax/SetFormCommand.php, line 17
Contains \Drupal\views\Ajax\SetFormCommand.

Namespace

Drupal\views\Ajax
View source
class SetFormCommand implements CommandInterface {

  /**
   * The rendered output of the form.
   *
   * @var string
   */
  protected $output;

  /**
   * The title of the form.
   *
   * @var string
   */
  protected $title;

  /**
   * The URL of the form.
   *
   * @var string
   */
  protected $url;

  /**
   * Constructs a \Drupal\views\Ajax\ReplaceTitleCommand object.
   *
   * @param string $output
   *   The form to display in the modal.
   * @param string $title
   *   The title of the form.
   * @param string $url
   *   (optional) An optional URL of the form.
   */
  public function __construct($output, $title, $url = NULL) {
    $this->output = $output;
    $this->title = $title;
    $this->url = $url;
  }

  /**
   * Implements \Drupal\Core\Ajax\CommandInterface::render().
   */
  public function render() {
    $command = array(
      'command' => 'viewsSetForm',
      'output' => $this->output,
      'title' => $this->title,
    );
    if (isset($this->url)) {
      $command['url'] = $this->url;
    }
    return $command;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SetFormCommand::$output protected property The rendered output of the form.
SetFormCommand::$title protected property The title of the form.
SetFormCommand::$url protected property The URL of the form.
SetFormCommand::render public function Implements \Drupal\Core\Ajax\CommandInterface::render(). Overrides CommandInterface::render
SetFormCommand::__construct public function Constructs a \Drupal\views\Ajax\ReplaceTitleCommand object.