Shopware plugin system
provides you with the option to create a configuration page for your plugin without any knowledge of templating or the Shopware Administration
.config.xml
file inside of a Resources/config
directory in your plugin root. The content of the config.xml
will be dynamically rendered in the administration. Below you'll find an example structure:config.xml
follows a simple syntax. You can organize the content in <card>
elements. Every config.xml
must contain a minimum of one <card>
element and each <card>
must contain one <title>
and at least one <input-field>
. See the minimum config.xml
below:xsi:noNamespaceSchemaLocation
as shown above and fetch the external resource into your IDE if possible. This enables auto-completion and suggestions for this XML file and will therefore help you to prevent issues and bugs.<card>
<title>
is translatable, this is managed via the lang
attribute. By default the lang
attribute is set to en-GB
, to change the locale of a <title>
just add the attribute as follows:<input-field>
has to contain at least a <name>
element. The <name>
element is not translatable and has to be unique, since it will be used as the technical identifier for the config element. The field <name>
must at least be 4 characters long and consist of only lower and upper case letters. It can contain numbers, but not at first place - see this pattern: [a-zA-Z][a-zA-Z0-9]*
<input-field>
can be of different types, this is managed via the type
attribute. Unless defined otherwise, your <input-field>
will be a text field per default. Below you'll find a list of all available <input-field type="?">
.<input-field>
. Every <input-field>
has to start with the <name>
element. After the <name>
element you can configure any of the other settings mentioned above. Beside these settings, they have the followings in common: label, helpText, defaultValue and disabled.<label>
, <placeholder>
and <helpText>
are used to label and explain your <input-field>
and are translatable. You define your <label>
, <placeholder>
and <helpText>
the same way as the <card><title>
, with the lang
attribute. Please remember, that the lang
attribute is set to en-GB
per default.defaultValue
setting to your <input-field>
to define a default value for it. This value will be imported into the database on installing and updating the plugin. We use Symfony\Component\Config\Util\XmlUtils for casting the values into the correct PHP types.<disabled>
setting to any of your <input-field>
elements to disable it.<disabled>
only takes boolean values.<copyable>
setting to your <input-field>
which are of type text
or extensions of it. This will add a button at the right, which on click copies the content of your <input-field>
into the clipboard.<copyable>
only takes boolean values<options>
to add settings to a <input-field>
of the types single-select
and multi-select
. Each <option>
represents one setting you can select.<options>
element must contain at least one <option>
element. Each <option>
element must contain at least one <id>
and one <name>
element. As you can see above, <name>
elements are translatable via the lang
attribute.<component name="componentName">
element. This element can render many admin components. It is also possible to render your own admin component which you could deliver with your plugin. The name of the component has to match the components name in the administration, for example sw-entity-single-select
. The component also needs a <name>
element first. All other elements within the component element will be passed to the rendered admin component as properties. For some components you could also use label
and placeholder
.config.xml
and show you the result.