You are here

class SetFormCommand in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views_ui/src/Ajax/SetFormCommand.php \Drupal\views_ui\Ajax\SetFormCommand
  2. 10 core/modules/views_ui/src/Ajax/SetFormCommand.php \Drupal\views_ui\Ajax\SetFormCommand

Provides an AJAX command for setting a form submit URL in modal forms.

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

Hierarchy

Expanded class hierarchy of SetFormCommand

1 file declares its use of SetFormCommand
ViewsFormBase.php in core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php

File

core/modules/views_ui/src/Ajax/SetFormCommand.php, line 12

Namespace

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

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

  /**
   * Constructs a SetFormCommand object.
   *
   * @param string $url
   *   The URL of the form.
   */
  public function __construct($url) {
    $this->url = $url;
  }

  /**
   * {@inheritdoc}
   */
  public function render() {
    return [
      'command' => 'viewsSetForm',
      'url' => $this->url,
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SetFormCommand::$url protected property The URL of the form.
SetFormCommand::render public function Return an array to be run through json_encode and sent to the client. Overrides CommandInterface::render
SetFormCommand::__construct public function Constructs a SetFormCommand object.