Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It seems the given example for hook_field_info_alter default widget override in field.api.php is wrong ? It is "default widget" but should be "default_widget".
Comment | File | Size | Author |
---|---|---|---|
#2 | wrong-api-example-about-default-widget-override-3113124-1.patch | 467 bytes | b2f |
Comments
Comment #2
b2f CreditAttribution: b2f commentedComment #4
Kristen PolThanks for the patch.
1) Patch applies cleanly to 8.9, 9.0, and 9.1.
2) Searching the code before the patch for "default widget" and only found the item from the patch (other than in comments):
3) After patch,
default widget
is changed todefault_widget
as expected.4) Marking RTBC though not sure this needs manual testing.
Comment #5
Kristen PolComment #6
xjmComment #11
xjmThanks, good catch. It is indeed
default_widget
, as can be seen in the code that responds to it in\Drupal\Core\Field\WidgetPluginManager
:(Or, for that matter, in the annotation of every field type plugin... I don't know that spaces are even possible in annotation keys since the annotation definitions are mapped onto variables in each annotation class.)
Committed to 9.1.x and cherry-picked to 9.0.x, 8.9.x, and 8.8.x as a patch-eligible documentation bugfix. Thanks!