2

I've just (finally) upgraded from EE1.x to EE2.5.5. (I was able to use Importer and Matrix to recreate my photo galleries with enough functionality to maintain them as a "legacy" gallery. If you are interested in what I did, let me know.) But I digress.

I now want to take advantage of many of the new cool 3rd party field types like Wygwam, Channel Images, Polls, Tags, and others. (And, I'd like to remove field types that I no longer use such as embeds for videos and a second Summary field.)

My question is about the best to do this. And, really "how does it work"?

I've seen from an existing post that it is okay to simply convert existing text fields to Wygwam fields, so I get that and it makes sense.

What happens if I get rid of a field? Will that contents still be in the data base? Can I keep the code to display that field in place in my template and use a conditional to render it only if it exists (even though it is no longer a valid "input" field)?

Also, if I create a second field group that contains my new ideal setup and associate my channel with it, all the old entries will still render, again if I have the old field name in my template. Actually, I've tried this and it seems to work, I just had to use new unique names for each field and then use a conditional to print whichever one has content. This works, I just want to be sure my assumptions behind "why" are correct. So, comments on these "rules" are welcomed:

  1. You can associate an existing field with a new field type. (But, I assume this is only for like types: text to text, for example. What happens if I try to convert an old text field to Matrix, for example?)

  2. If I delete a field from my publish form, the data is still there and associated with the "old" field name? Can I now re-use that field name? (Haven't tried this till I understand what will happen.)

  3. I can change the field group for a channel to a new group, but the fields must be uniquely named (can't have same name as old fields) and I need to update my templates to reflect this.

I think that's enough to let me know how this works. If it does work okay, then I'll need to figure out how to display search results from old and new fields, and some stuff like that. (Excerpt won't work across both field groups, I assume.) What other "gotchas" are there?

4

What happens if I get rid of a field? Will that contents still be in the data base?

No, if you delete a field from a field group the data is gone.

Can I keep the code to display that field in place in my template and use a conditional to render it only if it exists (even though it is no longer a valid "input" field)?

It shouldn't cause any issues as long as it is wrapped in a simple conditional. For example...

{if some_non_existent_field}{some_non_existent_field}{/if}

...is not rendered even though this isn't an existing field. But without the conditional you'll just see {some_non_existent_field} unparsed in the rendered template.

You can associate an existing field with a new field type. (But, I assume this is only for like types: text to text, for example. What happens if I try to convert an old text field to Matrix, for example?)

It mostly seems to work just when converting text-type fields, or fields that store data in the same way, but there are exceptions. For example it works fine converting the native File fieldtype to Assets (haven't tested with the latest version, though). And I believe there are other special fieldtypes that have a built-in conversion utility for specific, similar fieldtypes.

In my test converting Textarea to Matrix the data was not immediately lost, but it was no longer shown in the template using the old tag. And the first time the entry was re-saved the data was gone (emptied or replaced by Matrix data). If you're unsure what the results would be just make a database backup and experiment, checking the result in the exp_channel_data table.

If I delete a field from my publish form, the data is still there and associated with the "old" field name? Can I now re-use that field name? (Haven't tried this till I understand what will happen.)

Do you mean if you delete it from a field group? If you do this the data is gone (the field is deleted from the exp_channel_data table along with the data). You could immediately create a new field with the same name as the deleted field if you wanted to. If instead you mean hide a field in the publish form using Publish Layouts, nothing is lost or changed other than the field's visibility.

I can change the field group for a channel to a new group, but the fields must be uniquely named (can't have same name as old fields) and I need to update my templates to reflect this.

Right. Every field must have a unique short name. And you'll have to update your templates.


One approach to moving forward with new fields while keeping legacy data intact is just to create new, parallel fields using any new fieldtypes you want to take advantage of. Then relabel your old fields (relabel, not rename) as "Legacy" and ignore them when you publish new entries. In your templates output content using conditionals based on the presence of data in the legacy fields or based on the date you switched over.

| improve this answer | |
  • Thanks. I think I'll actually create a new channel with a new field group and fields. Then, in my channel entries, gather content from both channels. And, use conditionals to render either old or new -- whichever is associated with the post I'm displaying. – Rick Robinson Feb 5 '13 at 2:51
  • Good idea! I can see how the two-channel approach would be very clean. – Alex Kendrick Feb 5 '13 at 3:11
  • The only problem I'm having with the 2-channel approach is the excerpt field for search results is not showing anything from the new channel. I'm searching across both channels and the search finds content from both channels, and that content is rendered in the search-results page -- except for the excerpt. I have the summary field in the new group assigned as the excerpt field (same as I do for the old group). Any ideas? – Rick Robinson Feb 7 '13 at 18:43
  • If I understand your question...I'd recommend abandoning the excerpt setting and variable. Then in your search results template create your own excerpts using the relevant custom fields and a word-limiter plugin. – Alex Kendrick Feb 7 '13 at 18:51
  • the trouble with using word_limit is that if there is an img tag within the limit, it renders the photos. I only want text and "excerpt" does that. – Rick Robinson Feb 7 '13 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.