Field form widget alter hook executed without all element details

Created on 12 February 2019, about 6 years ago
Updated 7 November 2024, 5 months ago

Problem:

In a recent project I've had to leverage the hook_field_widget_form_alter() to append further processors to a datetime field. Additionally, I was originally altering and updating the `#date_year_range` property. However, I noticed that upon executing this hook the form element's "getInfo()" had yet to be called and by setting our own #process callbacks it would negate the inclusion of the DateTime::getInfo()['#process'] list from being included.

It would seem that this may be intentional based on implementation and the execution of when hook_field_widget_form_alter() is called in comparison to the element manager for appending additional properties.

Current (workaround) solution

The current solution that I utilized was to explicitly include the definition of DateTime::getInfo() properties that were being originally set in the `hook_field_widget_form_alter()`.

🐛 Bug report
Status

Postponed: needs info

Version

11.0 🔥

Component

field system

Created by

🇨🇦Canada amcgowanca

Live updates comments and jobs are added and updated live.
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.

  • 🇳🇿New Zealand quietone

    The hook_field_widget_form_alter was removed in #3261241: Remove deprecated field module functions and replace by hook_field_widget_complete_form_alter or hook_field_widget_complete_WIDGET_TYPE_form_alter. Is this particulate problem reproducible on a currently supported version of Drupal?

    Since we need more information to move forward with this issue, I am setting the status to Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

  • Status changed to Closed: cannot reproduce 19 days ago
  • 🇦🇺Australia acbramley

    Closing as per #11

Production build 0.71.5 2024