"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/modules/content_moderation/src/Plugin/views/field/ModerationStateField.php" (26 Nov 2020, 1190 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "ModerationStateField.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\content_moderation\Plugin\views\field;
    4 
    5 use Drupal\content_moderation\Plugin\views\ModerationStateJoinViewsHandlerTrait;
    6 use Drupal\views\Plugin\views\field\EntityField;
    7 
    8 /**
    9  * A field handler for the computed moderation_state field.
   10  *
   11  * @ingroup views_field_handlers
   12  *
   13  * @ViewsField("moderation_state_field")
   14  */
   15 class ModerationStateField extends EntityField {
   16 
   17   use ModerationStateJoinViewsHandlerTrait;
   18 
   19   /**
   20    * {@inheritdoc}
   21    */
   22   public function clickSort($order) {
   23     $this->ensureMyTable();
   24 
   25     // This could be derived from the content_moderation_state entity table
   26     // mapping, however this is an internal entity type whose storage should
   27     // remain constant.
   28     $storage = $this->entityTypeManager->getStorage('content_moderation_state');
   29     $storage_definition = $this->entityFieldManager->getActiveFieldStorageDefinitions('content_moderation_state')['moderation_state'];
   30     $column_name = $storage->getTableMapping()->getFieldColumnName($storage_definition, 'value');
   31     $this->aliases[$column_name] = $this->tableAlias . '.' . $column_name;
   32 
   33     $this->query->addOrderBy(NULL, NULL, $order, $this->aliases[$column_name]);
   34   }
   35 
   36 }