hook_field_widget_form_alter is not longer supported in D10

Created on 23 February 2024, 4 months ago

Problem/Motivation

On Drupal 10 hook_field_widget_form_alter got removed and it is now replaced by hook_field_widget_complete_form_alter according to the change record: https://www.drupal.org/node/3180429

On this module we are making usage of the hook_field_widget_form_alter() to preset the current_domain when create new Taxonomies o, Image Medias, etc...Unfortunately this functionality stopped to work on D10 due to the deprecation.

Proposed resolution

We should replace hook_field_widget_form_alter() because it is deprecated to hook_field_widget_complete_form_alter().
More details on this link: https://www.drupal.org/node/3180429

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇱🇹Lithuania a.raguckas Kaunas

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @a.raguckas
  • Status changed to Needs review 4 months ago
  • 🇮🇳India abhishek_virasat

    fixed the issue and created patch please review it.

  • 🇱🇹Lithuania a.raguckas Kaunas

    Hi. I just send first pull request please review.

  • 🇪🇸Spain jlbellido

    Hello,

    I've checked the patch from #2 but unfortunately it is not complete and didn't work for me.
    I've also tested the MR from #4 and it did work. Now the current domain is applied as default value for taxonomies in my case.

    Finally, I'm adding some additional context information to the ticket description.

  • 🇪🇸Spain jlbellido

    Ok, I had a second look and I was mistaken.

    #2 Is correct, because it is using hook_field_widget_single_element_form_alter which is the recommended replacement for hook_field_widget_complete_form_alter().

    #4 Uses hook_field_widget_complete_form_alter() instead but it is not needed for this context.

    In any case, I think it would be good to have a MR with the #2 approach. In that way it is easier for maintainers to merge it.

    Thanks both!

Production build 0.69.0 2024