Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
$305 per month—let's make that $500!Learn more
Unlike its analogue it works with documents in any context and has the ability to specify additional parameters in the snippet call, allowing output of resources normally not displayed, for example, hidden resources. By specifying the parameter &class it can get the field of any MODX object. It may be called as an [Output Modifier] 3.
It takes the general properties and sampling results of pdoTools and some of its own:
|&id||Current resource||Resource ID.|
|&top||Selects the root-level parent of the specified resource.|
|&topLevel||Selects the resource's parent at this level from the root level.|
|&default||Specifies the resource field to return if &field is empty. Faster than the Output Modifier filter :default =|
|&output||It specifies the string that is returned if &default and &field are all empty .|
|&toPlaceholder||If not empty, the snippet will save the field value to a placeholder with the same name, instead of displaying it to the screen.|
If you specify &top or &topLevel, but not a &context, an additional request to the database will be made to determine the context.
Does not support working with chunk or snippet objects, as it returns only one field.
The snippet can be used as an Output Modifier:
You can specify properties in a JSON array. For example, selecting the second parent of the resource and returning its «longtitle»:
But it is better to use a normal snippet call - it is faster and more convenient:
[[pdoField? &id=`[[*id]]` &field=`longtitle` &top=`2` ]]