WebformElementBase::hiddenElementAfterBuild() does not handle AccessResult objects

Created on 3 October 2025, 4 months ago

Problem/Motivation

WebformElementBase::hiddenElementAfterBuild() assumes #access is always a boolean but it can also be an AccessResult object.

Steps to reproduce

Alter a field like this:

/**
 * Implements hook_form_alter().
 */
function test_form_alter(array &$form): void {
  $form['elements']['name']['#access'] = AccessResult::forbidden();
}

The field is not displayed but hiddenElementAfterBuild() thinks it is.

Proposed resolution

hiddenElementAfterBuild() should check both cases (boolean and AccessResult objects).

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

6.3

Component

Code

Created by

🇫🇷France prudloff Lille

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

Merge Requests

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