Skip to content
Snippets Groups Projects

Issue #3526249: Move the access logic in FormBuilder::handleInputElement() to...

Open Issue #3526249: Move the access logic in FormBuilder::handleInputElement() to...
2 unresolved threads
Open Ishani Patel requested to merge issue/drupal-3526249:3526249-move-the-access into 11.x
2 unresolved threads
@@ -185,6 +185,21 @@ public function __construct(FormValidatorInterface $form_validator, FormSubmitte
$this->themeManager = $theme_manager;
}
/**
* Determines if the element is accessible based on the #access property.
*
* @param array $element
* A renderable array element.
*
* @return bool
* TRUE if the element should be considered accessible.
*/
protected function isElementAccessible(array $element): bool {
return !isset($element['#access']) ||
($element['#access'] instanceof AccessResultInterface && $element['#access']->isAllowed()) ||
($element['#access'] === TRUE);
}
/**
* {@inheritdoc}
*/
@@ -1228,7 +1243,7 @@ protected function handleInputElement($form_id, &$element, FormStateInterface &$
!in_array($element['#type'], ['item', 'value'], TRUE) &&
(
($form_state->isProgrammed() && $form_state->isBypassingProgrammedAccessChecks()) ||
($form_state->isProcessingInput() && (!isset($element['#access']) || (($element['#access'] instanceof AccessResultInterface && $element['#access']->isAllowed()) || ($element['#access'] === TRUE))))
($form_state->isProcessingInput() && $this->isElementAccessible($element))
);
// Set the element's #value property.
Loading