Problem/Motivation

The Media Directories module renames the "- None -" label when selecting a taxonomy term to "Root directory" in a hook_field_widget_WIDGET_TYPE_form_alter implementation. This no longer works in Drupal 10 - see https://www.drupal.org/node/3180429

Steps to reproduce

  1. Have the module enabled, and a media entity configured to use a media directories vocabulary
  2. Go to create a Media entity with directories enabled
  3. Expected: the default/none label in the "Directory" field to read "Root directory"
  4. Actual: the label reads "- None -" (the core default)

Proposed resolution

Amend media_directories_field_widget_options_select_form_alter() to implement hook_field_widget_complete_WIDGET_TYPE_form_alter instead, i.e. rename it to media_directories_field_widget_complete_options_select_form_alter() and update the function code accordingly.

Remaining tasks

Review & apply patch.

CommentFileSizeAuthor
#3 fix-widget-form-alter-d10-3406309-3.patch943 bytespfaocle

Comments

pfaocle created an issue. See original summary.

pfaocle’s picture

Issue summary: View changes
pfaocle’s picture

StatusFileSize
new943 bytes

Patch attached.

pfaocle’s picture

Assigned: pfaocle » Unassigned
Status: Active » Needs review
ytsurk’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for filing this issue. Your patch looks good and works.

We use now the newly proposed hook.

  • ytsurk committed b84e8c33 on 2.1.x authored by pfaocle
    Issue #3406309 by pfaocle: "None" option is not renamed to "Root...
ytsurk’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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