You are here

class OpenCommand in Colorbox Load 8

Defines an AJAX command to open content in a colorbox.

Hierarchy

Expanded class hierarchy of OpenCommand

File

src/OpenCommand.php, line 10

Namespace

Drupal\colorbox_load
View source
class OpenCommand implements CommandInterface {

  /**
   * The content for the colorbox.
   *
   * @var string
   */
  protected $content;

  /**
   * Constructs an OpenCommand object.
   *
   * @param string $content
   *   The content that will be placed in the colorbox.
   */
  public function __construct($content) {
    $this->content = $content;
  }

  /**
   * Render.
   *
   * {@inheritdoc}.
   */
  public function render() {
    return [
      'command' => 'colorboxLoadOpen',
      'data' => $this->content,
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
OpenCommand::$content protected property The content for the colorbox.
OpenCommand::render public function Render. Overrides CommandInterface::render
OpenCommand::__construct public function Constructs an OpenCommand object.