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

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(protected string $id, protected 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 Overrides CommandWithAttachedAssetsInterface::getAttachedAssets
TabledragWarningCommand::render public function 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.