function ContentModerationTestViewsHooks::viewsQueryAlter

Implements hook_views_query_alter().

See also

\Drupal\Tests\content_moderation\Kernel\ViewsModerationStateSortTest::testSortRevisionBaseTable()

File

core/modules/content_moderation/tests/modules/content_moderation_test_views/src/Hook/ContentModerationTestViewsHooks.php, line 21

Class

ContentModerationTestViewsHooks
Hook implementations for content_moderation_test_views.

Namespace

Drupal\content_moderation_test_views\Hook

Code

public function viewsQueryAlter(ViewExecutable $view, QueryPluginBase $query) : void {
    // 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');
    }
}

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