Closed (won't fix)
Project:
Year Only
Version:
9.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Aug 2021 at 12:51 UTC
Updated:
17 Dec 2025 at 04:35 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
tim-dielsComment #3
gaurav-mathur commentedComment #4
gaurav-mathur commentedPatch #2 not working in drupal 9.4.8.Please reroll the patch.
Thank you.
Comment #5
justcaldwellComment #6
tim-dielsRe-rolled patch.
Comment #8
mortona2k commentedChanging target branch.
Comment #10
justcaldwellI'm inclined to keep the widget code as simple as possible.
For projects that need this, wouldn't it be possible to add support for yearonly field items to the select2 widget itself by implementing
hook_field_widget_info_alter()? Something like:Comment #11
justcaldwellI confirmed that you can use the method in #10 to enable the select2 widget for yearonly fields. That said, I get the error below when trying to add new content after switching to the select2 widget.
Error: Call to a member function getSettableOptions() on null in Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsWidgetBase->getOptions()That's in my Drupal 10.4.9 test instance. YMMV.
Absent other evidence, I'll chalk that up to the fact that Select2 is no longer actively maintained, and is replaced by Tagify.