ModerationStateField.php in Drupal 10
File
core/modules/content_moderation/src/Plugin/views/field/ModerationStateField.php
View source
<?php
namespace Drupal\content_moderation\Plugin\views\field;
use Drupal\content_moderation\Plugin\views\ModerationStateJoinViewsHandlerTrait;
use Drupal\views\Plugin\views\field\EntityField;
class ModerationStateField extends EntityField {
use ModerationStateJoinViewsHandlerTrait;
public function clickSort($order) {
$this
->ensureMyTable();
$storage = $this->entityTypeManager
->getStorage('content_moderation_state');
$storage_definition = $this->entityFieldManager
->getActiveFieldStorageDefinitions('content_moderation_state')['moderation_state'];
$column_name = $storage
->getTableMapping()
->getFieldColumnName($storage_definition, 'value');
$this->aliases[$column_name] = $this->tableAlias . '.' . $column_name;
$this->query
->addOrderBy(NULL, NULL, $order, $this->aliases[$column_name]);
}
}