-
Notifications
You must be signed in to change notification settings - Fork 7
Tutorial System Settings
Many of your projects will require MODX System Settings. System Settings are handled as Seed-Data -- this means that we can define any MODX object as a file and therefore version control it. Any MODX object can be defined as an array and Repoman will import it as a MODX object.
To add System Settings to your Repoman project, add a file named modSystemSetting.php to your project's model/seeds/ directory (create this directory if it doesn't already exist).
Here is an example of some System Settings defined by the Gmarker Extra:
<?php
/*-----------------------------------------------------------------
* Lexicon keys for System Settings follows this format:
* Name: setting_ + $key
* Description: setting_ + $key + _desc
-----------------------------------------------------------------*/
return array(
array(
'key' => 'gmarker.formatting_string',
'value' => '',
'xtype' => 'textfield',
'namespace' => 'gmarker',
'area' => 'gmarker:default'
),
array(
'key' => 'gmarker.templates',
'value' => '',
'xtype' => 'textfield',
'namespace' => 'gmarker',
'area' => 'gmarker:default'
),
);
/*EOF*/
From the Seed-Data docs, the format for the seed data file names is this:
[ordering_prefix.]classname[.identifier].[php|json]
We can add one or
The xType determines what kind of form field will be visible when a user edits this setting in the manager. The most common are listed below:
-
combo-boolean: stored values are 1 and 0; the GUI will display "Yes" and "No" -
textfield: standard text field -
textarea: standard textearea -
text-password: standard password field (input is masked) -
numberfield: used for entering numbers -
modx-combo-language: allows user to select a language -
modx-combo-template: allows user to select a template -
modx-combo-content-type: allows user to select a content type -
modx-combo-charset: allows user to select a character set -
modx-combo-rte: like the textarea, but with formatting controls -
modx-combo-context: allows user to select a context
There are others. Bob Ray has documented a full list of available xTypes.
When Repoman installs or updates a package, it automatically adds several of its own System Settings.
{namespace}.core_path{namespace}.assets_path{namespace}.assets_url{namespace}.version
You do not need to add these System Settings to your project! These settings are required for Repoman to function: it manages them and their values automatically based on where your repo is located and the contents of your composer.json file.
© 2014 and beyond by Craftsman Coding