Namespace

Drupal\colorbox_load

Fichier

src/OpenCommand.php

View source
<?php

namespace Drupal\colorbox_load;

use Drupal\Core\Ajax\CommandInterface;

/**
 * Defines an AJAX command to open content in a colorbox.
 */
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,
        ];
    }

}

Classes

Titre Deprecated Résumé
OpenCommand Defines an AJAX command to open content in a colorbox.