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

braintec created an issue. See original summary.

braintec’s picture

Issue summary: View changes

Ahmad Abbad made their first commit to this issue’s fork.

ahmad abbad’s picture

The hook_form_field_storage_config_edit_form_alter() is deprecated and should be replaced by hook_form_field_config_edit_form_alter().
https://www.drupal.org/node/3386675

ahmad abbad’s picture

Status: Active » Needs review
braintec’s picture

I tried testing the fork ui_patterns_settings-3409221 and encountered this issue. After updating Drupal from 10.1.7 to 10.2 and replacing ui_patterns_settings with the proposed fork, the problem shifts to the core and returns the error: 'InvalidArgumentException: The configuration property settings.allowed_values.0.label.0 doesn't exist.' in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php). Installing Drupal 10.2 from scratch and using the fork instead of the official release doesn't change anything, or rather, the module doesn't throw an error, but the core does. It seems that someone else has reported this issue with the core.

kerrymick’s picture

I tested the fork as a patch on 10.2 and it fixed the issue for me.

liber_t’s picture

It's worked for me too

steveoriol’s picture

It's worked for me too

Add inside "patches" section on composer.json files :

[...]
"drupal/ui_patterns_settings":{
    "[3409221] ui_patterns_settings.module - array_unshift()": "https://git.drupalcode.org/project/ui_patterns_settings/-/merge_requests/21.patch"
},
[...]
rajab natshah’s picture

Title: ui_patterns_settings.module - array_unshift() » Fix TypeError: array_unshift(): Argument #1 ($array) must be of type array, null given in array_unshift() Caused by Deprecated Hooks in Drupal ~10.2.0
Status: Needs review » Reviewed & tested by the community
very_random_man’s picture

Yep, worked for me too. Thanks!

ekes’s picture

Works, but it the hook_ should be ui_patterns_settings_ rather than ui_patterns_ as that's this module's name (rather than the one it depends on).

carlosmonroy’s picture

Issue summary: View changes

It's worked for me, as show by #10
Thanks!

thejimbirch’s picture

Issue summary: View changes

Another +1 for RTBC

kekkis’s picture

Edit: I misread the patch. Sorry. It's a hook_form_FORM_ID_alter now and will not cause incompatibility.

kekkis’s picture

Status: Reviewed & tested by the community » Needs work

I have to take back my takeback. In Drupal 10.1 and below, the field configuration form and the field storage configuration form were two separate forms. In Drupal 10.2, the forms have been combined into one. Changing the hook this way would break the module when used with Drupal 10.1 (or below). If I'm reading the code correctly, changing the hook this way (from using form id field_storage_config_edit_form to using form id field_config_edit_form) would make the alterations move from the field storage config form to the field config form which is an entirely different thing in D10.1 and below. So then basically the submit function added in the hook, ui_patterns_settings_form_field_storage_config_edit_form_submit, will run on the field config rather than field storage config, meaning that the stored configuration would change, and most probably would not work correctly in other parts of the module anymore.

Based on the above I'm setting this back to Needs work. A solution should be found that works both on Drupal 10.1 and Drupal 10.2, at the very least, based on the project page's statement of supported major versions.

thejimbirch’s picture

Drupal 10.1 EOL is slated for the Week of June 17, 2024.

catch’s picture

If the new hook implementation is only needed on Drupal 10.2, and the old hook implementation is only needed on Drupal 10.1, then including them both, but returning early based on comparing against Drupal::VERSION, should work.

grimreaper’s picture

StatusFileSize
new2.32 KB

Hi,

Uploading patch for Composer usage.

This error prevents adding field on content entity types with Field UI on Core 10.2.

grimreaper’s picture

Version: 8.x-2.1 » 8.x-2.2-alpha1

Walli made their first commit to this issue’s fork.

huzooka made their first commit to this issue’s fork.

huzooka’s picture

Status: Needs work » Needs review
StatusFileSize
new4.63 KB

I continued working on MR 21

  1. Restored the original hook for Drupal versions lower than 10.2.0
  2. Added helper which determines whether we need the new hook or not
  3. Renamed the original hook to _ui_patterns_field_form_alter, and aligned it a bit so it can work both on the old storage form and also on the new, combined form

Adding a traditional patch too.

huzooka’s picture

Assigned: Unassigned » huzooka
Status: Needs review » Needs work
huzooka’s picture

Assigned: huzooka » Unassigned
Status: Needs work » Needs review
StatusFileSize
new4.59 KB

Addressed review feedback, asking for a next review.

Adding the usual traditional patch too.

duaelfr’s picture

grimreaper’s picture

Discussed with @Christian.wiedemann, I will try to check if both hooks can be preserved for backward compatibility instead of going to a hook_form_alter.

If not possible, we do a release then drop core 10.1 support in this issue.

grimreaper’s picture

Assigned: Unassigned » grimreaper

grimreaper’s picture

Version: 8.x-2.2-alpha1 » 8.x-2.x-dev
Assigned: grimreaper » Unassigned

New MR 27 ready for review.

grimreaper’s picture

@herved, https://www.drupal.org/u/herved should also be credited. But as he only did code review in Gitlab, he is not appearing in the list.

christian.wiedemann’s picture

Status: Needs review » Fixed

Thanks to all!

christian.wiedemann’s picture

The new version will only be for drupal 10.2 or above

Status: Fixed » Closed (fixed)

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

thejimbirch’s picture

Updating attribution

julien tekrane’s picture

Thanks @DuaelFr for your mention. It was not done but not an issue for me. Most important : resolution

christian.wiedemann’s picture