Documentation

fetchSettingsFromQuery

array|null public static
\Bitrix\Main\UI\Filter\Options::fetchSettingsFromQuery(
 array $fields = array(),
 \Bitrix\Main\HttpRequest $request
);

Static method gets field values from query. Method returns array with values or null on failure.

Parameters

ParameterDescriptionVersion
$fieldsArray with fields.

Each fields must contain mandatory properties and can contain optional properties as well, specific to a field type (see. item Field properties below).
$requestQuery - object of class HttpRequest

Field properties



Properties for all field types:

Key Type Required Default valueDescription
id String Yes Field identifier. For example, NAME, USERNAME
name String Yes Displayed field name. It will be shown to user.
default Boolean No false Defines, if field as shown by default.
type Boolean No "string" Defines field type.


Field properties depending on the type:

(by default, without specific type, fields are converted "string" type)

  • string (строка)

    You may skip indicating string fields type as having a string type. Just as well, you can directly indicate field type as "string".

    Example

  • list (list)

    Lists can have singular or multiple selection. Uses singular single selection by default.

    Additional properties
    Key Type Required Default valueDescription
    params Array No array("multiple" => "N") Defines list parameters. Can contain property multiple with the value "Y"|"N". Property determines, if list has multiple selection.
    items Array No array("Not specified") Associative array, defining search items.
    Example

  • custom_date (arbitrary date)

    Allows performing complex filtering by dates. This field allows select items, which, for example, were created on the 1st of April and December, in 2012 and 2014.

    Example

  • date (дата)

    Date type fields can support several types of values, declared in \Bitrix\Main\UI\Filter\DateType. It is a "precise date", "range", "recent N days" and etc.

    Additional properties
    Key Type Required Default valueDescription
    time Boolean No false Enables time support.
    exclude Array No array() Defines, which value types to be excluded from current field. Value types are declared in \Bitrix\Main\UI\Filter\DateType.
    Examples

  • number (numeric)

    Numeric field type can support several value types, declared in \Bitrix\Main\UI\Filter\NumberType.

    Example

  • checkbox (чекбокс)

    Checkbox type field implements list type field with preset list items. Checkbox, in contrast to native control, has three values: "Yes", "No" and "Not selected".

    Additional properties
    Key Type Required Default valueDescription
    valueType String No "" Defines type of returned value. Can accept "numeric" value or an empty string. When "numeric" is specified, returns 1|0 as value. If not specified, or a specified value is different from "numeric", returns Y|N.
    Example

  • custom_entity (entity selection)

    Implements user and software interface for interaction with data outside filter. For example, CRM entity selection, group, user selection and etc.

    Additional properties
    Key Type Required Default valueDescription
    valueType String No "" Defines type of returned value. Can accept "numeric" value or an empty string. When "numeric" is specified, returns 1|0 as value. If not specified, or a specified value is different from "numeric", returns Y|N.
    params Array No array("multiple" => "N") Defines field parameters. It can contain property multiple with value "Y"/"N". The property defines, if multiple selection is supported.

    User interface is implemented as text field with inserted values.

    Software interface implements set of Javascript events and field object with set of methods for interaction with it.

    Events:

    • customEntityFocus [Field:BX.Main.ui.CustomEntity] - triggered, when field is in focus. Usually, this a popup window with possible field value options is shown next to this field.
    • customEntityBlur [Field:BX.Main.ui.CustomEntity] - triggered, when field has lost focus. Usually, this event closes previously displayed popup window. Event is not triggered, when focus shifts to the popup window.
    • customEntityRemove [Field:BX.Main.ui.CustomEntity] - triggered, when user has deleted a field.

    Methods:

    • BX.Main.ui.CustomEntity.setData (label:string, value:string|items:object[]) : void - sets a field value.
      Field parameters with single selection of value
      Parameter Type Required Description
      label String Yes Value, shown to user.
      value String Yes Value to be returned by filter.
      Field parameters with value multiple selection support
      Parameter Type Required Description
      item Object[] Yes Array with object with properties label and value.
      value String Yes Value to be returned by filter.
    • BX.Main.ui.CustomEntity.setPopupContainer (container:HTMLElement) : void - sets popup window container. It's required for correct event processing.
    • BX.Main.ui.CustomEntity.getCurrentValues () : object - returns current field value. Returns object with properties label, value.
    • BX.Main.ui.CustomEntity.getField () : ?HTMLElement - returns link to the root field item.
    • BX.Main.ui.CustomEntity.getLabelNode () : ?HTMLInputElement - returns link to input field item.
    • BX.Main.ui.CustomEntity.isMultiple () : Boolean - checks, if the field is multiple.
    Example

© «Bitrix24», 2001-2024
Up