content_moderation_test_views.module

Same filename in other branches
  1. 9 core/modules/content_moderation/tests/modules/content_moderation_test_views/content_moderation_test_views.module
  2. 10 core/modules/content_moderation/tests/modules/content_moderation_test_views/content_moderation_test_views.module
  3. 11.x core/modules/content_moderation/tests/modules/content_moderation_test_views/content_moderation_test_views.module

Module file for the content moderation test views module.

File

core/modules/content_moderation/tests/modules/content_moderation_test_views/content_moderation_test_views.module

View source
<?php


/**
 * @file
 * Module file for the content moderation test views module.
 */
use Drupal\views\Plugin\views\query\QueryPluginBase;
use Drupal\views\ViewExecutable;

/**
 * Implements hook_views_query_alter().
 *
 * @param \Drupal\views\ViewExecutable $view
 *   The view object about to be processed.
 * @param \Drupal\views\Plugin\views\query\QueryPluginBase $query
 *   The query plugin object for the query.
 *
 * @see \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateSortTest::testSortRevisionBaseTable()
 */
function content_moderation_test_views_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
    // Add a secondary sort order to ensure consistent builds when testing click
    // and table sorting.
    if ($view->id() === 'test_content_moderation_state_sort_revision_table') {
        $query->addOrderBy('node_field_revision', 'vid', 'ASC');
    }
}

Functions

Title Deprecated Summary
content_moderation_test_views_views_query_alter Implements hook_views_query_alter().

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