Hi

I'm trying to get this working with some dummy data. I've set up a dummy course term, provider term, venue term and qualification term. I then created a 'course presentation' and linked it to my dummy terms. However when I preview the View or go to the /xcri-cap path my XML feed stops dead immediately after it outputs :

<mlo:credit>
              <credit:level>

Looking at the xcri-cap-feed.tpl.php file it looks as though the template is treating the 'credit' field collection exactly as it treats the other field variables using this code :

          <?php foreach ($course['credits'] as $credit): ?>
            <mlo:credit>
              <credit:level><?php print $credit['level']; ?></credit:level>
              <?php if($credit['scheme']): ?>
                <credit:scheme><?php print $credit['scheme']; ?></credit:scheme>
              <?php endif; ?>
              <credit:level><?php print $credit['value']; ?></credit:level>
            </mlo:credit>
          <?php endforeach; // credits?>

My dump ( image attached ) of $course shows that the structure of a field collection differs and I guess that is why this fails ?

Thanks

CommentFileSizeAuthor
credits.jpg88.64 KBEl Bandito

Comments

El Bandito’s picture

As a quick fix/bodge I added this to the xcri-cap-feed.tpl.php file at line 157 i.e. just before it processes $course['credits'].

 $num_elements = count($course['credits']);
		    $useful_elements = $num_elements / 2; //first half of the elements are the objects
			for ( $i=0; $i < $useful_elements; $i++ ) {
			  array_shift($course['credits']);
			}
		  

This just removes the FieldCollectionItemEntity objects that exist at the beginning of the array, leaving the structure that the existing template file seems to expect.

I am using the Field Collection module 7.x-1.0-beta4. I wonder if this is what has introduced this problem ?

hanoii’s picture

Status: Active » Fixed

This was sorted properly in the code, FieldCollectionItemEntity should be there at all.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.