Defines an AJAX command to open content in a colorbox.

Hierarchy

  • class \Drupal\colorbox_load\OpenCommand implements \Drupal\Core\Ajax\CommandInterface

Expanded class hierarchy of OpenCommand

Fichier

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

Titre Trier par ordre décroissant Modifiers Object type Résumé
OpenCommand::$content protected property The content for the colorbox.
OpenCommand::render public function Render.
OpenCommand::__construct public function Constructs an OpenCommand object.