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
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
Comment #2
dhruv.mittal commentedComment #4
dhruv.mittal commentedComment #5
jrockowitz commentedTests are passing, and I'm confident that element access controls have sufficient test coverage.
Comment #7
jrockowitz commented