<?php if ($blog_field_author_id = $blog_item->fields->item_id) : ?>
<?php $blog_field_author_id = $blog_item->fields->id;
$blog_item_author_id = $blog_item->fieldvalues[$blog_field_author_id][0];
$author_itemmodel = new FlexicontentModelItems();
$author_item = $author_itemmodel->getItem($blog_item_author_id, $check_view_access=false);
FlexicontentFields::getFieldDisplay($author_item,'headshot_photo');
$author_blog_image = $author_item->fields->display;
/* The $author_blog_image has the respective html to display the image related to the author */
HERE is where i need to insert the "author_blog_image" to the same position where "author_profile" is.
Here is a dump of my positions.
[array] positions
[stdClass object] before-description
Properties
[stdClass object] author_profile
[string] display = "Authors Blog02"
[string] id = "81"
[string] label = ""
[string] name = "author_profile"
I would like it to add a new object to the position in order to display it only in the front end not backend.
[stdClass object] author_profile_image
[string] display = "<img src="
dev.mysite.com/images/stories/flexicontent/m_author_blog02.png
" alt="Author Blog02" class="fc_field_image">"
[string] id = "8672"
[string] label = ""
[string] name = "author_blog_image"
This Is my code to render each position (in this case "before-description")
if (isset($blog_item->positions)) : ?>
<div class="lineinfo">
<?php foreach ($blog_item->positions as $field) : ?>
<span class="element">
<div class="blog_item_author">'
<?php if ($field->label) : ?>
<span class="label field_<?php echo $field->name; ?>"><?php echo $field->label; ?></span>
<?php endif; ?>
<span class="value field_<?php echo $field->name.'_img'; ?>"><?php echo $author_blog_image; ?></span>
</div>
<?php // endif; ?>
</span>
<?php endforeach; ?>
</div>
<?php endif; ?>