Stop using $error->arrayPropertyPath

Created on 16 January 2023, over 1 year ago
Updated 26 October 2023, 8 months ago

Problem/Motivation

The property is deprecated https://www.drupal.org/node/3307919 โ†’

Proposed resolution

Stop using it when module require 9.5 core

Remaining tasks

- Fix src/Plugin/Field/FieldWidget/ParagraphsWidget.php

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ซ๐Ÿ‡ทFrance andypost

Live updates comments and jobs are added and updated live.
  • PHP 8.2

    The issue particularly affects sites running on PHP version 8.2.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Charchil Khandelwal

    Charchil Khandelwal โ†’ made their first commit to this issueโ€™s fork.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 8 months ago
    180 pass
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium herved

    Argh, I just stumbled on this, more specifically the issue described in ๐Ÿ› Constraints on paragraph field highlight all fields in paragraph Needs review .
    I think the approach here makes more sense since arrayPropertyPath is deprecated.

    But patch #2 is not working for me: it doesn't remove the delta and doesn't pass the full path.
    I have the following violation path: $delta.subform.my_date_field.widget
    The delta should be removed just like \Drupal\Core\Field\WidgetBase::flagErrors does:

    // Separate violations by delta.
    $property_path = explode('.', $violation->getPropertyPath());
    $delta = array_shift($property_path);
    ...
    $violation->arrayPropertyPath = $property_path;
    

    Because it later passes the $delta_element to WidgetBase::errorElement
    This way NestedArray::getValue() would get ['subform', 'my_date_field', 'widget'] which is correct and returns the sub-element properly.

Production build 0.69.0 2024