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

Issue fork webform-3550092

Command icon 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

prudloff created an issue. See original summary.

dhruv.mittal’s picture

Assigned: Unassigned » dhruv.mittal

dhruv.mittal’s picture

Assigned: dhruv.mittal » Unassigned
Status: Active » Needs review
jrockowitz’s picture

Tests are passing, and I'm confident that element access controls have sufficient test coverage.

jrockowitz’s picture

Status: Needs review » Fixed

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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