Skip to content

Introduce new "beforeRegister" field lifecycle method #233

@kettanaito

Description

@kettanaito

What

Need to introduce a new field lifecycle method which controls the registration behavior of the field. This method is different from mapPropsToField, which controls the field record which goes to the registration. The suggested method actually controls whether the registration is needed.

Why

Currently Form.registerField() contains a radio field specific logic, which looks and is a hack. Instead, a new lifecycle method must control that behavior, while registerField() ensures that lifecycle method is called and reacts to it correspondingly.

Also, this allows to control the registration of the fields for custom fields.

How

  1. Introduce a new field lifecycle method.
  2. Extend fieldPresets.radio, adding the logic which is currently in Form.registerField() (for radio fields de-duplication when the radio field with the same name and present value is set)
  3. Ensure tests are passing.

Metadata

Metadata

Assignees

Labels

enhancementEnhances existing functionality.scope:architectureChanges affect architecture.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions