CoolCMS API

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 to getLabel()),
  • heading of the 2nd field: getLabel2() (search: getSearchLabel2() falling back to getLabel2()),
  • 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

applyRangeBounds()

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
On this page

Search results