BaseCommand.php

Contains \Drupal\edit\Ajax\BaseCommand.

Namespace

Drupal\edit\Ajax

File

drupal/core/modules/edit/lib/Drupal/edit/Ajax/BaseCommand.php
View source
<?php

/**
 * @file
 * Contains \Drupal\edit\Ajax\BaseCommand.
 */
namespace Drupal\edit\Ajax;

use Drupal\Core\Ajax\CommandInterface;

/**
 * Base AJAX command that only exists simplify Edit's actual AJAX commands.
 */
class BaseCommand implements CommandInterface {

  /**
   * The name of the command.
   *
   * @var string
   */
  protected $command;

  /**
   * The data to pass on to the client side.
   *
   * @var string
   */
  protected $data;

  /**
   * Constructs a BaseCommand object.
   *
   * @param string $data
   *   The data to pass on to the client side.
   */
  public function __construct($command, $data) {
    $this->command = $command;
    $this->data = $data;
  }

  /**
   * Implements Drupal\Core\Ajax\CommandInterface:render().
   */
  public function render() {
    return array(
      'command' => $this->command,
      'data' => $this->data,
    );
  }

}

Classes

Namesort descending Description
BaseCommand Base AJAX command that only exists simplify Edit's actual AJAX commands.