Combo Field (PRO)
Allows you to create a drop-down list of any objects, with the ability to select the fields to display and values
Settings:
Additional settings:
Settings | Description | Default |
---|---|---|
Model class | Standard MODX models, but you can add your own, for example, add msProduct model to combo_field_models system setting. | modUser, modUserGroup, modResource, modTemplate, modChunk, modSnippet, modCategory, modContext |
Display | Available fields of the selected model to display in the drop-down list | |
Value | Available fields of the selected model for the value in the drop-down list | |
Sort field | Field for sorting. | id |
Sorting direction | ASC or DESC | ASC |
Where conditions | Additional conditions for sampling. JSON format |
For example, we need a list of resources created by a specific user. This list should include the resource titles, with their aliases as the values.
To do this, select the model modResource
, set the displayed field to pagetitle
, and use alias
as the value. In the conditions, specify:
php
`[{"createdby": 2}]` // 2 is the ID of the desired user.
Result:
Output:
html
{$combofield} // alias