Documentation

User fields settings factory

Description and methods

This extension contains fragments of interfaces and logic, required for managing user field settings.

Main class for handling this extension

BX.UI.UserFieldFactory.Factory
Method Description Available from version
constructor(entityId: string, params: {}) Constructor.

Parameters:

  • entityId - string entity ID for fields to be created
  • params - additional parameters with the following structure:
    • menuId - identifier for menu with field type selection to create;
    • types - array with additional field types to be added to standard list;
    • bindElement - DOM-node for passing to object BX.Main.Popup for showing popup with field list;
    • configuratorClass - name for descendant class Configurator to be used instead of standard;
    • customTypesUrl - page URL to be opened in slider upon clicking at Additional field type;
    • moduleId - module identifier to be used in model UserField.
getFieldTypes(): Array Method returns array with field types with description.

Each item has the following structure:

  • name - string identifier [type](../../20_main/userfield/config/20_types.md);
  • title - title type;
  • description - type description;
  • defaultTitle - title by default for creating new field.
getMenu(params: {}): CreationMenu Method returns object CreationMenu.
  • params - additional parameters for passing in BX.Main.Popup popup with field type selection.
setConfiguratorClass(configuratorClassName: string|Function) Sets name for descendant class Configurator to be used instead of standard class.
setCustomTypesUrl(customTypesUrl: string): this Sets page URL to be opened in slider upon clicking at Additional field type.
getConfigurator(params: {}): Configurator Returns object Configurator для настройки поля userField.

params has the following structure:

  • userField - object UserField for displayed settings form;
  • onSave - callback for calling after saving the form;
  • onCancel - callback for calling after clicking cancel button.
createUserField(fieldType: string, fieldName: ?string): UserField Method returns new object UserField.

Parameters:

  • fieldType - type string ID;
  • fieldName - name for new field. When not passed, will be generated automatically.
getDefaultLabel(fieldType: string): string Method returns field title by default (for new).

Parameters:

  • fieldType - type string ID.
generateFieldName(): string Method generates field code based on entity and current time.
onCustomTypeClick() Handler method for click at Additional field type.

Events

Event Description
namespace: BX.UI.UserFieldFactory.Factory
OnGetUserTypesEvent is thrown after initializing available types of user fields.

Handler receives array with list of types fields that may be updated.

onCreateFieldEvent is thrown after creating UserField object in the method createUserField.

Handler can receive the object userField.

onCreateCustomUserFieldEvent is thrown after creating UserField object via full field settings form.

The handler can be receive the object userField.


© «Bitrix24», 2001-2024
Up