class ContentModerationTestViewsHooks
Hook implementations for content_moderation_test_views.
Hierarchy
- class \Drupal\content_moderation_test_views\Hook\ContentModerationTestViewsHooks
Expanded class hierarchy of ContentModerationTestViewsHooks
File
-
core/
modules/ content_moderation/ tests/ modules/ content_moderation_test_views/ src/ Hook/ ContentModerationTestViewsHooks.php, line 14
Namespace
Drupal\content_moderation_test_views\HookView source
class ContentModerationTestViewsHooks {
/**
* Implements hook_views_query_alter().
*
* @see \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateSortTest::testSortRevisionBaseTable()
*/
public function viewsQueryAlter(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');
}
}
/**
* Implements hook_views_data_alter().
*
* @see \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest
*/
public function viewsDataAlter(array &$data) {
if (isset($data['users_field_data'])) {
$data['users_field_data']['uid_revision_test'] = [
'help' => t('Relate the content revision to the user who created it.'),
'real field' => 'uid',
'relationship' => [
'title' => t('Content revision authored'),
'help' => t('Relate the content revision to the user who created it. This relationship will create one record for each content revision item created by the user.'),
'id' => 'standard',
'base' => 'node_field_revision',
'base field' => 'uid',
'field' => 'uid',
'label' => t('node revisions'),
],
];
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ContentModerationTestViewsHooks::viewsDataAlter | public | function | Implements hook_views_data_alter(). |
ContentModerationTestViewsHooks::viewsQueryAlter | public | function | Implements hook_views_query_alter(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.