1

I programmatically created a new (custom) filter for the user's view (admin/people).

Code for the filter:

hook_field_views_data_alter()
Plugin > views > filter class

The filter works perfectly, but when I execute BrowserTests, the filter is not available in the view. Probably because the user module installs the view and does not contain my custom filter.

Is there any way to make this filter available in my testing suite?


update

Tried both solutions in @4k4's comment. Both give me schema validation errors.

Solution 1 (adding the filter in code):

"Schema errors for views.view.user_admin_people with the following errors: views.view.user_admin_people:display.default.display_options.filters.field_ mymodule_target_id.type missing schema"

Solution 2 (adding the view in yml in my config/optional folder):

1) Drupal\Tests\mymodule\Browser\MyModuleViewBrowserTest::testFilterQuery
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for views.view.user_admin_people with the following errors: views.view.user_admin_people:display.default.display_options.filters.field_ mymodule_target_id.value non-scalar value but not defined as an array (such as mapping or sequence), views.view.user_admin_people:display.default.display_options.filters.field_ mymodule_target_id.expose.reduce missing schema, views.view.user_admin_people:display.default.display_options.filters.field_ mymodule_target_id.reduce_duplicates missing schema, views.view.user_admin_people:display.default.display_options.filters.field_ mymodule_target_id.type missing schema, views.view.user_admin_people:display.default.display_options.filters.field_vrt_channel_target_id.error_message missing schema
2
  • Add the filter to the view, see drupal.stackexchange.com/a/214571/47547
    – 4uk4
    Nov 26, 2019 at 10:10
  • @4k4 this gives me schema validation errors: "Schema errors for views.view.user_admin_people with the following errors: views.view.user_admin_people:display.default.display_options.filters.field_custom_reference_target_id.type missing schema" Nov 26, 2019 at 11:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.