class TabledragWarningCommand

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Ajax/TabledragWarningCommand.php \Drupal\Core\Ajax\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

Expanded class hierarchy of TabledragWarningCommand

See also

Drupal.AjaxCommands.prototype.tabledragChanged

Related topics

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.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.