As part of https://www.drupal.org/project/webform/issues/2982127 all composite elements are wrapped in a fieldset. In my case I have a composite element as a part of another field set to group a bunch of fields, but having a fieldset inside another fieldset is a bit odd.

Would be really good to be able to enable and disable this feature.

CommentFileSizeAuthor
#8 3005355-8.patch17.34 KBjrockowitz

Comments

dnmetelk created an issue. See original summary.

jrockowitz’s picture

Your request makes sense.

We would have to rework \Drupal\webform\Element\WebformCompositeFormElementTrait::preRenderWebformCompositeFormElement to support a #wrapper_type property which could then be the default 'fieldset' or a form 'item'.

dmitriim’s picture

Thank you for such a quick response.

I'm just wondering, should it just simply respect "FORM DISPLAY -> Title display" option of a composite element?

dmitriim’s picture

Also not sure if it's related, but it seems that "FORM DISPLAY -> Title display" is broken for a Fieldset element. For me it always displays a title even if I set the option to "invisible"

  • jrockowitz committed 5ffdbd4 on 3005355-composite-wrapper-type
    Issue #3005355: Optionally wrap grouped and composite elements in a...

  • jrockowitz committed ce8cf54 on 3005355-composite-wrapper-type
    Issue #3005355: Optionally wrap grouped and composite elements in a...
jrockowitz’s picture

The field title display is a separate issue. Please make sure it is not a theme (ie Bootstrap) specific issue.

The below code does hide a fieldset's legend in Bartik

test:
  '#type': fieldset
  '#title': test
  '#title_display': invisible
  textfield:
    '#type': textfield
    '#title': textfield

If you can replicate the issue via the Bartik or Seven them please create a new ticket.

jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new17.34 KB

Please review the attached patch and change record draft.

dmitriim’s picture

Yeah the field title display issue is related to a theme. Will have a look at the patch and test it as soon as I get a chance.
Thank you again for such a quick responses!

  • jrockowitz committed 56264ce on 8.x-5.x
    Issue #3005355 by jrockowitz: Optionally wrap grouped and composite...
jrockowitz’s picture

Status: Needs review » Fixed

I reviewed and committed the patch. Please download the latest dev release to review.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.