I have a live entry with an 'eventTime' text field having the content '2pm'.
I also have an unpublished draft saved for that same entry with the 'eventTime' field having the content '3pm'.
I use the following code in my front end template to retrieve the draft for the entry:
{% set entry = craft.entries.section('events').type('ofs').status(null).limit(1).first() %} {% if entry and entry.enabled %} {% set drafts = craft.entryRevisions.getDraftsByEntryId(entry.id) %} {% if drafts %} {% set entry = drafts[0] %} {% endif %} {% endif %} Yet the following tag in my template:
{{ entry.eventTime }} Always displays '2pm' - even though I know the draft is being loaded, as:
{{ entry.draftId }} Outputs the correct draft ID value.
How do I get it to display '3pm' - i.e. the correct content for the draft being loaded? I've noticed that draft data is stored differently in the database (shoved into a field called 'data' in the 'craft_entryDrafts' table). How do I get at it?