Импорт partial Option Sets
Последнее обновление not available | История страницы | Улучшить эту страницу | Сообщить о проблеме
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
$204 per month—let's make that $500!
Learn moreИмпорт Option Set выполняется ключом fred-import в JSON-объекте импорта.
- Импортировать можно только partial Option Sets
- Импорт работает только для Settings
- Весь объект импорта заменяется содержимым partial Option Set
Полный импорт¶
Полный импорт вместо complete Option Set уместен, когда базовый набор опций одинаков для многих Elements, включая Element, который использует только базовые опции. Пример: кнопки call to action во многих Elements, включая Element только с одной CTA-кнопкой.
Полный импорт Settings для Element только с CTA-кнопкой¶
{
"settings": {
"fred-import": "cta_settings"
}
}
Partial Option Set cta_settings¶
[
{
"name": "cta_class",
"label": "CTA Class",
"type": "select",
"options": {
"danger": "Red CTA",
"info": "Blue CTA",
"default": "Default CTA"
},
"value": "default"
},
{
"name": "show_cta",
"label": "Show CTA",
"type": "toggle",
"value": false
}
]
Частичный импорт¶
Часто используемые partial option sub-sets можно импортировать в complete Option Set.
Complete Option Set¶
Импорт cta_settings описан выше.
{
"settings": [
{
"name": "panel_class",
"label": "Panel Class",
"type": "text",
"value": ""
},
{
"fred-import": "cta_settings"
},
{
"fred-import": "text_color"
}
]
}
Partial Option Set text_color¶
{
"name": "color",
"label": "Text Color",
"type": "colorswatch",
"value": "black",
"options": [
{ "value": "primary", "color": "blue", "label": "Primary" },
"lightcoral",
"black",
"rgba(0,255,0,.5)"
]
}
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
$204 per month—let's make that $500!
Learn more










