
| Current Path : /var/www/html/rocksensor1/web/core/lib/Drupal/Core/Ajax/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor1/web/core/lib/Drupal/Core/Ajax/TabledragWarningCommand.php |
<?php
namespace Drupal\Core\Ajax;
use Drupal\Core\Asset\AttachedAssets;
/**
* 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.
*
* @see Drupal.AjaxCommands.prototype.tabledragChanged
*
* @ingroup ajax
*/
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;
}
}