I am trying to do something that should be easy in Views but I can't seem to be able to make it work.

I need to create a filter on top of the existing NumericFilter (Drupal\views\Plugin\views\filter\NumericFilter), but with a minimalistic approach like the following it is simply not working.

// @file src/Plugin/views/filter/FoobarProjectSizeRangeSelectionFilter.php

namespace Drupal\foobar_extra\Plugin\views\filter;
use Drupal\views\Plugin\views\filter\NumericFilter;
 * Class DateYearFilter
 * @ingroup views_filter_handlers
 * @ViewsFilter("project_size_range_select")
class FoobarProjectSizeRangeSelectionFilter extends NumericFilter {

The way I use is is pretty straight forward:

// @file foobar.views.php
 * Implements hook_views_data_alter().
function foobar_views_data_alter(array &$data) {
  // clone an existing field
  $data['node__field_a']['field_a_value_range'] = $data['node__field_a']['field_a_value'];
  // change name and filter ID
  $data['node__field_a']['field_a_value_range']['title'] = t("Foobar");
  $data['node__field_a']['field_a_value_range']['filter']['id'] = 'project_size_range_select';

  return $data;

Whenever I try to save a view using this filter plugin i get the following error:

 The configuration property display.default.display_options.filters.field_a_value_range.value.min doesn't exist.
 in Drupal\Core\Config\Schema\ArrayElement->get()
 (line 74 of ROOT/web/core/lib/Drupal/Core/Config/Schema/ArrayElement.php).

Right now I have "worked around it" implementing some custom and terrible hacks, but i'm pretty sure this is so simple that it should just work.

1 Answer 1


So, yeah I ended up investigating more and more and I needed to specify a config schema definition as it follows.

# @file config/schema/foobar.views.schema.yml
# Schema for the views plugins.

  type: views_filter
  label: 'Foobar numeric'

  type: views.filter_value.numeric
  label: 'Foobar Numeric'

The full gist is available here if anyone is interested.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.