FLEXIcontent version 2.0.0 RC9a (r1551)
I believe this issue hasn't been addressed in further commits, so it doesn't matter if it is the latest version.
I set up a fleximodule for a page. It displays items from a category. Each item has an image field and a minigallery field.
I set up (in module) to show the image field as an image source. And I turn off "display fields" for standard and featured items.
The problem is this setup adds to the document scripts of minigalleries of each item.
Code:
if ( !isset($item_field_arr[$item->id][$field->id]) )
{
$item_field_arr[$item->id][$field->id] = 1;
$css = "
#$htmltag_id {
width: ".$w_l."px;
height: ".$h_l."px;
margin-".$marginpos.": ".(($marginval+8)*$series)."px;
}
";
if ($thumbposition==2 || $thumbposition==4) {
} else if ($thumbposition==1 || $thumbposition==3) {
} else { // inside TODO
}
$document->addStyleDeclaration($css);
$otheroptions .= ($otheroptions?','.$otheroptions:'');
$js = "
(function($){
$(document).ready(function() {
$('#article-gallery').galleryView({
panel_width: 620,
panel_height: 350,
frame_width: 48,
frame_height: 48,
panel_scale: 'crop',
frame_gap: 5
});
});
})(jQuery);
";
$document->addScriptDeclaration($js);
}
The reason for this behavior is
mod_flexicontent/helper.php 434 line
FlexicontentFields::getFieldDisplay($row, $midata->name, null, 'display', 'module');
it loads image from the field for the item
this method is defined in
com_flexicontent/classes/flexicontnet.fields.php
It contains:
Code:
if (!isset($item->fields)) {
// This if will succeed once per item ... because getFields will retrieve all values
// getFields() will not render the display of fields because we passed no params variable ...
$items = array(&$item);
FlexicontentFields::getFields($items, $view);
}
There is no reason for
isset($item->fields) to be true, as I set not to load fields.
And clearly eventually
FlexicontentFields::getFields($items, $view) loads every field for an item even if I didn't want it to. Including the minigallery field, which though doesn't produce field output, but adds unnecessary scripts to the document.