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.
I have a couple of event types that use a "Date" field. I now want to modify that field to allow users to submit "end dates", but that option is no longer available (the check box is grayed out).
Why is it not possible to enable "end dates" once a Date is created, or once nodes using Date fields exist in the DB ?
Are there any suggested migration paths to add end dates to existing content types (ideally without affecting existing content) ?
Comments
Comment #2
glanster CreditAttribution: glanster commentedI´m having the same issue. Is there any feedback around about it?
Thanks!
Comment #3
herved CreditAttribution: herved commentedThis is what I came up with to add an optional end date to an existing date field with data in DB.
It is inspired from field_update_field().
If your field base is exported in features you also need to change your field_base export (a feature export after running the update might work):
and
Comment #4
bernig CreditAttribution: bernig as a volunteer commentedherved, your solution worked perfectly for 3 of my projects where I was about to scratch my head for a very long time. Thanks a lot for your work.
Comment #5
herved CreditAttribution: herved commented@bernig You're welcome. Glad to hear my solution helped others as well ;)
Comment #6
viswanathsai CreditAttribution: viswanathsai as a volunteer commentedHi can you please explain how can i implement this, i can't figure out how do this.
Comment #7
herved CreditAttribution: herved commented@viswanathsai This is a standard hook_update() to be placed in one of your custom modules .install file.
See also https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...
Comment #8
steinmb CreditAttribution: steinmb as a volunteer commentedComment #10
Collins405 CreditAttribution: Collins405 commentedYou absolute beauty!! Thank you for this!!