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

Breadcrumb

  1. Drupal Core 11.1.x
  2. TabledragWarningCommand.php

class TabledragWarningCommand

AJAX command for conveying changed tabledrag rows.

This command is provided an id of a table row then does the following:

  • Marks the row as changed.
  • If a message generated by the tableDragChangedWarning is not present above the table the row belongs to, that message is added there.

Hierarchy

  • class \Drupal\Core\Ajax\TabledragWarningCommand implements \Drupal\Core\Ajax\CommandInterface, \Drupal\Core\Ajax\CommandWithAttachedAssetsInterface

Expanded class hierarchy of TabledragWarningCommand

See also

Drupal.AjaxCommands.prototype.tabledragChanged

Related topics

Ajax API
Overview for Drupal's Ajax API.
1 file declares its use of TabledragWarningCommand
EntityDisplayFormBase.php in core/modules/field_ui/src/Form/EntityDisplayFormBase.php

File

core/lib/Drupal/Core/Ajax/TabledragWarningCommand.php, line 19

Namespace

Drupal\Core\Ajax
View source
class TabledragWarningCommand implements CommandInterface, CommandWithAttachedAssetsInterface {
    
    /**
     * Constructs a TableDragWarningCommand object.
     *
     * @param string $id
     *   The id of the changed row.
     * @param string $tabledrag_instance
     *   The identifier of the tabledrag instance.
     */
    public function __construct(string $id, string $tabledrag_instance) {
    }
    
    /**
     * {@inheritdoc}
     */
    public function render() {
        return [
            'command' => 'tabledragChanged',
            'id' => $this->id,
            'tabledrag_instance' => $this->tabledrag_instance,
        ];
    }
    
    /**
     * {@inheritdoc}
     */
    public function getAttachedAssets() {
        $assets = new AttachedAssets();
        $assets->setLibraries([
            'core/drupal.tabledrag.ajax',
        ]);
        return $assets;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
TabledragWarningCommand::getAttachedAssets public function Gets the attached assets. Overrides CommandWithAttachedAssetsInterface::getAttachedAssets
TabledragWarningCommand::render public function Return an array to be run through json_encode and sent to the client. Overrides CommandInterface::render
TabledragWarningCommand::__construct public function Constructs a TableDragWarningCommand object.
RSS feed
Powered by Drupal