Problem/Motivation

One of my colleagues suggested to add #description_display property to the Section element.
Currently it is not possible to set the description position (after, before, invisible) of the field.

Proposed resolution

Create a patch for it.

User interface changes

As is:
as is

To be:
to be

Comments

paulocs created an issue. See original summary.

paulocs’s picture

Assigned: paulocs » Unassigned
Status: Active » Needs review
StatusFileSize
new3.8 KB

Status: Needs review » Needs work

The last submitted patch, 2: 3218299-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

jrockowitz’s picture

Version: 6.x-dev » 8.x-5.x-dev

Make sense to add this feature. Thank you for creating the patch. This feature should also be for 8. x-5.x

paulocs’s picture

I'll give another try...

paulocs’s picture

Status: Needs work » Needs review
StatusFileSize
new4.36 KB

A patch for 8.x-5.x.

jrockowitz’s picture

Status: Needs review » Needs work

Can you please add 'webform_section_description_demo' example to webform.webform.test_element_section.yml and add some test coverage to \Drupal\Tests\webform\Functional\Element\WebformElementSectionTest? This will make it much easier to review the patch.

paulocs’s picture

Assigned: Unassigned » paulocs

Yes

paulocs’s picture

Assigned: paulocs » Unassigned
Status: Needs work » Needs review
StatusFileSize
new3.84 KB
new7.94 KB

See if this is enough to cover the new feature.
I added text field element to the section elements to delimit if they are displayed after or before.
I also added a small change to the webform-section.html.twig

jrockowitz’s picture

StatusFileSize
new7.13 KB
new6.51 KB

The patch looks great. If all the tests pass, I think it is RTBC.

Changes include

  • Minor reordering of variables in preprocessor
  • Tweaked test to use pattern assertions instead of targeting markup with spaces
  • Move alteration of section element's description display options from WebformElementBase to WebformSection

Status: Needs review » Needs work

The last submitted patch, 10: 3218299-10.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new8.23 KB
new7.66 KB

There was a minor issue with the webform's YAML. Locally, I am did not have the PHP YAML extension installed and DrupalCI does.

paulocs’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new88.45 KB

Thanks for the improvement @jrockowitz.
All changes in #12 make sense because the code is more organized than #9.
Attaching an image to confirm that the new feature is working.

Moving to RTBC.

paulocs’s picture

StatusFileSize
new7.67 KB

Here is a patch for webform 6.x

jrockowitz’s picture

Don't worry about the 6.x patch. What I have been doing is commit the 8.x-5.x patch and then merge 8.x-5.x into 6.x. This makes it easier to maintain the two branches.

  • paulocs authored b56bfb4 on 8.x-5.x
    Issue #3218299 by paulocs, jrockowitz: Make #description_display...

  • paulocs authored b56bfb4 on 6.x
    Issue #3218299 by paulocs, jrockowitz: Make #description_display...
jrockowitz’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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