Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

BaseCommand.php

Same filename in this branch
  1. 11.1.x vendor/composer/composer/src/Composer/Command/BaseCommand.php

Namespace

Drupal\Core\Ajax

File

core/lib/Drupal/Core/Ajax/BaseCommand.php

View source
<?php

namespace Drupal\Core\Ajax;


/**
 * Base command that only exists to simplify 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 $command
     *   The name of the command.
     * @param string $data
     *   The data to pass on to the client side.
     */
    public function __construct($command, $data) {
        $this->command = $command;
        $this->data = $data;
    }
    
    /**
     * {@inheritdoc}
     */
    public function render() {
        return [
            'command' => $this->command,
            'data' => $this->data,
        ];
    }

}

Classes

Title Deprecated Summary
BaseCommand Base command that only exists to simplify AJAX commands.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal