RangePairFieldsTrait
Shared building of the from/to field pair for range types (edit `RangeHandler`, search `LimitRangeSliderHandler`).
Texts come from the parameter translation:
- row label:
getName(), - heading of the 1st field:
getLabel()(search:getSearchLabel()falling back togetLabel()), - heading of the 2nd field:
getLabel2()(search:getSearchLabel2()falling back togetLabel2()), - placeholder of the 1st field:
getPlaceholder()(search variant with fallback), - placeholder of the 2nd field:
getPlaceholder2()(search variant with fallback).
Headings are carried in the option columnLabel and the template renders them above the field;
the partner field to has rangePartner (the template skips it in the main loop).
Table of Contents
Methods
- buildRangePair() : BaseControl
- applyRangeBounds() : void
- Applies the slider bounds (`min`/`max`), only when the module supplied them in the context.
- applyRangePlaceholder() : void
- rangeColumnLabel() : string|null
- rangeName() : string
Methods
buildRangePair()
protected
buildRangePair(Form $form, ParameterInterface $parameter, string $key, ParameterFormContext $context) : BaseControl
Parameters
- $form : Form
- $parameter : ParameterInterface
- $key : string
- $context : ParameterFormContext
Return values
BaseControlapplyRangeBounds()
Applies the slider bounds (`min`/`max`), only when the module supplied them in the context.
private
applyRangeBounds(BaseControl $fromField, BaseControl $toField, ParameterInterface $parameter, ParameterFormContext $context) : void
Without bounds the slider has nowhere to drag, so it is not rendered and two number fields
remain. The bounds also go into the HTML min/max attributes, so the browser respects them
for typed input and the spinner keeps the user within the range.
Parameters
- $fromField : BaseControl
- $toField : BaseControl
- $parameter : ParameterInterface
- $context : ParameterFormContext
applyRangePlaceholder()
private
applyRangePlaceholder(BaseControl $field, ParameterInterface $parameter, ParameterFormContext $context, bool $first) : void
Parameters
- $field : BaseControl
- $parameter : ParameterInterface
- $context : ParameterFormContext
- $first : bool
rangeColumnLabel()
private
rangeColumnLabel(ParameterInterface $parameter, ParameterFormContext $context, bool $first) : string|null
Parameters
- $parameter : ParameterInterface
- $context : ParameterFormContext
- $first : bool
Return values
string|nullrangeName()
private
rangeName(ParameterInterface $parameter, ParameterFormContext $context) : string
Parameters
- $parameter : ParameterInterface
- $context : ParameterFormContext