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' => 'Relate the content revision to the user who created it.',
            'real field' => 'uid',
            'relationship' => [
                'title' => 'Content revision authored',
                'help' => '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' => 'node revisions',
            ],
        ];
    }
}

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