function ContentModerationTestViewsHooks::viewsDataAlter

Implements hook_views_data_alter().

See also

\Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest

File

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

Class

ContentModerationTestViewsHooks
Hook implementations for content_moderation_test_views.

Namespace

Drupal\content_moderation_test_views\Hook

Code

public function viewsDataAlter(array &$data) : void {
    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'),
            ],
        ];
    }
}

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