Overriding Option Sets
Last updated Jan 31st, 2020 | Page history | Improve this page | Report an issue
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.
Backers
Budget
$306 per month—let's make that $500!
Learn moreUse cases for overriding an option set are when you need to change things like switching remote
from true
to false
. You can also use them more extensively like overriding all the Settings for a single Element without maintaining an entierly separate Option Set.
Overrides are located on the Overrides
tab when editing a specific Element in the Fred Manager page.
Note: You must include all settings you want to show as controls in the Override panel. The best way to start your override is by copying the entire settings JSON node by clicking the Preview Option Set
button and selecting the JSON object(s) and pasting into the overrides text area.
Override specific options¶
These options are only available through override, not when creating Option Set.
merge¶
When setting merge
to true
, the override will get recursively merged to current Option Set. Default value is false
.
rteConfig¶
You can override or define new RTE Configs through this option.
Example¶
Assume you have an Intro plan with a background image and a call to action link. You want a version for both single-page sites with anchor link external URLs on the page, but also one which allows links to other Fred pages on your site. You don't need the scroll-to-link (see below) and you want to change the link object to be a MODX page select list.
Original Setting¶
{
"settings": [
{
"name": "image",
"label": "Background Image",
"type": "image",
"value": "assets/themes/starter/img/Fred-hero.jpg"
},
{
"fred-import": "background_settings"
},
{
"name": "linkscroll",
"label": "Scroll Link",
"type": "toggle",
"value": true
},
{
"name": "link",
"label": "Link anchor or URL",
"type": "text",
"value": null
}
]
}
Options Override¶
{
"settings": [
{
"name": "image",
"label": "Background Image",
"type": "image",
"value": "assets/themes/starter/img/Fred-hero.jpg"
},
{
"fred-import": "background_settings"
},
{
"name": "link",
"label": "Link",
"type": "page",
"value": {
"id": 1,
"url": "[[~1]]"
}
}
]
}
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.
Backers
Budget
$306 per month—let's make that $500!
Learn more