Problem/Motivation
Part 5 of splitting #3595219: 3.0 Exploration. This issue exposes a set of per-element configuration fields that are currently missing for numeric, text, container and a few simple element types, plus telephone submission handling. These are grouped because each is a small, independent field-exposure on an existing element type.
Missing fields in 3.x:
- Numeric (
number,range):min,max,step,readonly, and the range output mode. - Text (
textfield,textarea, autocomplete): counter settings (count by character/word, limit, message) andinput_hide. - Color:
colorSize. - Details container:
open. - Containers (extending
ContainerBase):randomize. - Signature:
readonly. - Telephone (
tel): the international/format fields, and submissions of phone numbers are not validated/accepted.
Proposed resolution
- Add a numeric interface exposing
min/max/step(+readonly) and aWebformRangeOutputenum for the range output mode. - Expose counter settings via a
webform_element_counterproducer and aWebformCounterTypeenum, plusinput_hidevia aWebformDescriptionPlacement-style enum where relevant. - Expose
colorSize(withWebformColorSizeenum), detailsopen, containerrandomizeand signaturereadonly. - Expose
telfields (withWebformPhoneNumberFormatenum) and accept/validate phone-number submissions inWebformSubmit.php.
Remaining tasks
- Add enums
WebformRangeOutput,WebformCounterType,WebformColorSize,WebformPhoneNumberFormat,WebformDescriptionPlacementundersrc/Enum/; wire intoWebformSchemaBuilder.php. - Add
src/Plugin/GraphQL/DataProducer/WebformElementCounter.php; extendWebformElementMetadata.php/WebformElementProperty.phpfor the new fields. - Register the new fields/interfaces in
WebformExtension.php. - Validate phone-number submissions in
WebformSubmit.php. - Tests:
NumericFieldsTest,NumericBaseExtrasTest,CounterTest,InputHideTest,ColorTest,DetailsTest,FlexboxTest,SignatureTest,TextFieldTest,TelTest,FormSubmissionTelephoneValidationTest, plus the matchingtests/queries/*.gqlfixtures and shared test-form additions.
API changes
Additive: new fields on numeric / text / color / details / container / signature / tel elements, several new enums, and telephone submission validation. No fields removed.
Release notes snippet
Numeric, text, color, details, container, signature and telephone elements now expose their relevant configuration (min/max/step, readonly, counters, input hiding, color size, details open, container randomize, phone format), and telephone submissions are validated.
Issue fork graphql_webform-3598988
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
pfrenssenThere is a small B/C break in here: we were previously exposing the
min,maxandstepfields on numeric elements as integers, but in fact in the Webform module they can be configured as decimal values. In the MR the type is changed fromInttoFloat. We need to publish a change record.Comment #5
pfrenssen