- Issue created by @Mokys
- last update
over 1 year ago 29,383 pass
Hello, so after this patch was committed to Drupal core Using ConstraintViolation::$arrayPropertyPath bugs on PHP 8.2 β
/**
* {@inheritdoc}
*/
public function errorElement(array $element, ConstraintViolationInterface $error, array $form, FormStateInterface $form_state) {
// Validation errors might be a about a specific (behavior) form element
// attempt to find a matching element.
if (!empty($error->arrayPropertyPath) && $sub_element = NestedArray::getValue($element, $error->arrayPropertyPath)) {
return $sub_element;
}
return $element;
}
This code from paragraphs stops working, and you can never reach $sub_element, because !empty($error->arrayPropertyPath condition every time returns false, even if a value is not empty.
1. Install paragraphs
2. Apply the patch
https://www.drupal.org/project/paragraphs/issues/2994660
β¨
Add a support of targeting subelements during validation
Needs work
3. In ConstraintValidator set path ->atPath() to the nested element.
4. !empty($error->arrayPropertyPath) will return false.
Add this code to make it work.
/**
* {@inheritdoc}
*/
public function __isset($name) {
return isset($this->$name);
}
Active
10.1 β¨
Last updated