-
Notifications
You must be signed in to change notification settings - Fork 78
migxLoopCollection
$prefix
$usecustomprefix
$packageName
$limit
$offset
$totalVar
$where
$queries
$sortConfig
$groupby
$joins
$selectfields
$classname
$debug
$tpl
$wrapperTpl
$toSeparatePlaceholders
$toPlaceholder
$outputSeparator
$placeholdersKeyField
$toJsonPlaceholder
$jsonVarKey
$addfields
(prints out the raw object)
[[migxLoopCollection?
&packageName=`list-of-something`
&classname=`list-of-something`
]]
Selects the id and pagetitle of all modResources under the parent 3 and saves it to placeholder "json"
[[migxLoopCollection?
&classname=`modResource`
&selectfields=`id,pagetitle`
&where=`{"parent":"3"}`
&toJsonPlaceholder=`json`
]]
[[+json]]
Selecting from a customPackage and sorting it by its position-field:
[[migxLoopCollection?
&packageName=`customPackage`
&classname=`CustomPackage`
&tpl=`CustomPackageItem`
&sortConfig=`[{"sortby":"position","sortdir":"ASC"}]`
]]
Selecting from a customPackage and inserting two additional placeholders via the 'addfields' parameter. This example adds a placeholder called 'field1' with value of 'one' and a placeholder called 'field2' with value of 'two'. These placeholders can then be used in the tpl via the placeholders [[+field1]]
and [[+field2]]
.
[[migxLoopCollection?
&packageName=`customPackage`
&classname=`CustomPackage`
&tpl=`CustomPackageItem`
&addfields=`field1:one,field2:two`
]]
Note: The position-field has to be of type int for the sorting to work properly. This is also needed when using the this.renderPositionSelector renderer on such a column.
Right now migxLoopCollection is not aware of used media-sources for images in the config.
To work around this you will need to add an output modifier:
$output = str_replace('./','',$input);
if ($mediasource = $modx->getObject('sources.modMediaSource',$options)){
$output = $mediasource->prepareOutputUrl($output);
}
return '/' . $output;
And then call it on your image like:
[[+image:addmediasourcepath=`2`]]