Issue #3618298: Fix the test content setup so every term has a referencing node
Fixes the exposed widget of the filter: BEF checkboxes lost their checked
state after a reload, and a dependent filter value that fell outside the
current option set broke the whole view.
What changed
valueForm()now builds onInOperator::valueForm()and only adds the
reference-view specifics (dependency JS, option order restore, hiding an
empty filter). The option list, single/multiple handling, the- Any -
fallback and the operators that take no value are core's job again.- Plugin settings moved out of
valueForm()intobuildOptionsForm(),
where they belong;valueForm()builds the value widget only. - The unconditional user input rewrite is replaced by
alignExposedInput(),
which aligns the submitted value with the options currently available.
This has to happen while the form is built: core rejects an unknown value
inFormValidator::performRequiredValidation(), and Views then aborts the
build, so the view rendered an error and no results at all. computeEffectiveValue()was already used by both the AJAX cascade and the
widget; the change is that it no longer renumbers the values it returns.
Checkbox widgets look their raw input up by option key, so the renumbered
list left every box unchecked.EntityReferenceFilterRebuildCommanddrops
the keys again when it serialisesselected, because the JavaScript checks
that payload withArray.isArray().
Tests
- New coverage for the exposed widgets that had none: BEF checkboxes, a
multi-value select, and the pruning of a stale dependent value. - Test fixture fixes: the reference field value was written under a wrong
key, so no node actually referenced a term; the fixture now creates one
node per term. better_exposed_filtersadded as a dev dependency and to the test base
classes — the test view has a BEF-rendered display and cannot be saved
without it.
Edited by Maxim Kashuba