Pixel & Tonic

Playa

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

Matrix celltype

One of the most powerful gems in Playa is its celltype for Matrix. This can be useful if you wish to store extra information on a relationship.

For example, pretend you have a People channel and a Bands channel, and you want to create a relationship between the two called “Favorite Bands”. Generally, a normal Playa field would excel here.

But let’s say you also want to store an explanation as to why each band is a favorite. The easiest way to go about this would be to create an Matrix field, and give it a Playa column (set to only allow one selection) and a Text column, labeled “Band” and “Why?”, respectively.

Here’s how the template might look for this field:

<ol>
  {favorite_bands_matrix}
    <li>
      <h5>{band_playa}{title}{/band_playa}</h5>
      <p>{why}</p>
    </li>
  {/favorite_bands_matrix}
</ol>