unnecessary element access properties in yaml

Created on 24 June 2025, 25 days ago

Problem/Motivation

In certain cases, when you add elements and save, the YAML generated could be something like this (this is just one field from the YAML/source):

name:
  '#type': textfield
  '#title': Name
  '#required': true
  '#access_create_roles':
    - authenticated
    - anonymous
  '#access_update_roles':
    - authenticated
    - anonymous
  '#access_view_roles':
    - authenticated
    - anonymous

because the roles are in default properties of element base (WebformElementBase.php; line 262, 265, 268), it should be as simple as:

name:
  '#type': textfield
  '#title': Name
  '#required': true

Steps to reproduce

1. Go to /admin/people/roles of the website.
2. Change the order of roles by moving 'Anonymous user' anywhere 'Authenticated user'
3. Go to any webform, open any element for editing and press save (with or without making any change)
4. Now go to the source of the same form and you will notice these properties are added to the element (that you saved in step 3):

  '#access_create_roles':
    - authenticated
    - anonymous
  '#access_update_roles':
    - authenticated
    - anonymous
  '#access_view_roles':
    - authenticated
    - anonymous

Revert what you did in step 2 and do the step 3 again, the above code will be gone from the source.

Proposed resolution

Unable to determine, maybe something in the WebformElementBase.php file

Remaining tasks

-

User interface changes

none

API changes

none

Data model changes

none

🐛 Bug report
Status

Active

Version

6.2

Component

Code

Created by

🇦🇺Australia imranbcc

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024