Pixel & Tonic

Playa

version works on just rated
4.3 EE2 $75
Buy Now Get Help

Conversion Instructions

Note: It’s highly recommended that you backup your database before running any of Playa’s converters.

Converting native Relationship fields into Playa fields

You might think that converting a native Relationship field into a Playa field is as simple as changing its Field Type setting. But unfortunately that’s not the case, because ExpressionEngine will actually delete all of the relationships created by your Relationship field before Playa ever gets a chance to convert them.

So we build a Relationship field converter right into Playa 4. Here’s how to do it:

  1. Go to Add-Ons → Fieldtypes → Playa
  2. Choose which fields you wish to convert in the “Convert Relationship fields?” setting, and click “Submit”
  3. Update your templates to use Playa’s syntax:
    Relationship Playa
    {related_entries id="my_field"} ... {/related_entries} {my_field} ... {/my_field}
    {reverse_related_entries channel="my_channel"} ... {/reverse_related_entries} {exp:playa:parents channel="my_channel"} ... {/exp:playa:parents}

Moving Solspace’ Related Entries relationships into Playa fields

If you had Solspace’ Related Entries module installed before updating to ExpressionEngine 2, don’t worry! We built a Related Entries converter into Playa 4 that’ll help you resurrect those lost relationships.

Due to the fact that Related Entries associated relationships directly with entries, as opposed to Playa which associates them with individual publish fields, we had to get a little creative with this one. So the conversion script will actually create new Playa fields for you – one Playa field per field group that has at least one relationship created by Related Entries.

So here’s how to do it:

  1. Go to Add-Ons → Fieldtypes → Playa
  2. Choose “Yes” in the “Convert Related Entries?” setting, and click “Submit”
  3. Go to Admin → Channel Administration → Custom Fields, and take note of the names of your new Playa fields
  4. Update your templates to use Playa’s syntax
    Related Entries Playa
    {exp:related_entries:entries} ... {/exp:related_entries:entries} {exp:channel:entries ... } {my_field} ... {/my_field} {/exp:channel:entries}
    {exp:related_entries:entries entry_id="5"} ... {/exp:related_entries:entries} {exp:playa:children entry_id="5"} ... {/exp:playa:children}
    {exp:related_entries:entries direction="reverse"} ... {/reverse_related_entries} {exp:channel:entries} {exp:playa:parents field="my_field"} ... {/exp:playa:parents} {/exp:channel:entries}
  5. If everything looks good, go into your database and delete your exp_related_entries table

Caveats

  • Playa doesn’t have the concept of “main” related entries, so the conversion script just accounts for those by putting any previous “main” entries at the top of the list.
  • Playa doesn’t do anything magical for “single entry pages”. {exp:playa} tags must either live within an {exp:channel:entries} tag pair, or be given an entry_id= parameter.
  • Playa doesn’t have a way to display an entry’s parents and children at the same time, a la {exp:related_entries:entries direction="both"}.