The config.xml defines the Warp7 theme settings.
In the theme settings, you can control basic preferences for the theme layouts, widgets and menus. Each menu tab has its own option panel and is defined in the config.xml
.
<fields>
elements define the menu tabs and create panels for their options.
<?xml version="1.0" encoding="utf-8"?>
<config>
<fields name="Settings" icon="uk-icon-cogs">
...
</fields>
<fields name="Layouts" icon="uk-icon-columns">
...
</fields>
<fields name="Modules" icon="uk-icon-th">
...
</fields>
<fields name="Menus" icon="uk-icon-reorder">
...
</fields>
<fields name="Information" icon="uk-icon-info-sign">
...
</fields>
</config>
A <fields>
element will add a new tab to the theme settings. The value of the name
attribute will render the tab name.
<fields name="MY-MENUITEM" icon="uk-icon-info-sign">
...
</fields>
<field>
elements inside <fields>
elements define the options for the menu tabs.
You can use basic XML types to create new options for your theme settings. This could be for example a radio button, a checkbox or an input field.
Type | Description |
---|---|
section |
Defines the section for a description text. |
radio |
Defines a radio button. |
checkbox |
Defines a checkbox. |
select |
Defines a dropdown list. |
text |
Defines a input text. |
textarea |
Defines a multiline text input. |
There are also some Warp7 specific types available: layouts
, verify
, styles
, compile
and info
.
<!-- Section field -->
<field type="section" name="Headline" description="A description text." />
<!-- Checkbox field -->
<field type="checkbox" name="my-option-1" value="1" label="A description text." />
<!-- Radio field -->
<field type="radio" name="my-option-2" value="1" label="A description text." />
<!-- Select field -->
<field type="select" name="my-option-3" default="0">
<option value="0">Option A</option>
<option value="1">Option B</option>
<option value="2">Option C</option>
<option value="3">Option D</option>
</field>
<!-- Text field -->
<field type="text" name="my-option-4" />
<!-- Textarea field -->
<field type="textarea" name="my-option-5" class="uk-form-width-large" rows="8" />
To create a new option, add a <field>
element to the setting, i.e. inside the <fields>
element, to which you want to add your option. You can also copy an existing one and modify it to your needs.
The config.xml
defines which theme settings are available. If someone saves the theme settings, they are saved in the minified config.json
file. With every new saving process, the file will be overridden.
Warp themes provide a separate config.default.json
file, where the default theme settings are stored. This gives you the opportunity to restore your backend to the default settings and backup your own config.json
file, making your settings update proof.
Note For a better overview, use the JSON Formatter - this will bring your minified file into easily readable markup.
Variables from the config.xml
are stored in the config object. To access a variable's value, simply use the get method. Learn more about it in the theme layout chapter.