-
Notifications
You must be signed in to change notification settings - Fork 10
Customizing resources
Mollify allows storing customized versions of resources outside Mollify folders, which makes updates easier.
To avoid losing customizations when updating Mollify version, set up a customizations folder in the mollify root, instead of inside any of the folders in the Mollify package.
Suggested folder structure is:
- Mollify app root/
- custom (CREATE THIS)
- backend/
- js/
- localization/
- css/
- templates/
- index.html
Under folder "custom", create all custom plugins, stylesheets and localizations.
Customization folder location and URL are defined in configuration.
For example:
$CONFIGURATION = array(
...
"customizations_folder" => "/htdocs/mollify/custom/",
"customizations_folder_url" => "http://myhost/mollify/custom/",
)
The option 'customizations_folder_url' defines the URL where this folder is accessible, and is needed for serving plugin resources from the customization folder.
Using client resource map, different resources can be mapped into custom location. These include any client loaded resources:
- plugin texts
- plugin javascripts
- plugin css
- templates
Copy original file into the custom location, and add resource map entry to load your version instead.
For example, following loads custom "mainview.html" from folder "custom" :
mollify.App.init({
"resource-map" : {
"templates/mainview.html" : "custom/templates/mainview.html"
},
...
});
For example, following loads custom localizations file for Registration plugin:
mollify.App.init({
"resource-map" : {
"backend/plugin/Registration/localization/texts_en.json": "custom/localization/texts_registration_en.json"
},
...
});
Plugins can be also located in the customizations folder. This allows, for example, creating custom version of built-in plugin, or placing separately downloaded plugins outside the installation plugin folder, which makes upgrades easier as new version package does not remove or overwrite these plugins.
Plugins located in customization folder are marked with setting "custom" => TRUE, for example:
"plugins" => array(
"Comment" => array(
"custom" => TRUE
),
)
All plugins must be located inside folder "plugin" under the customization folder.
For example, with previous example, it is expected that plugin "Comments" is found under [customization_folder_location]/plugin/Comment.
When a backend feature needs text resources, these are stored in a text file. With a customizations location defined, Mollify will look for any text resource from that location first.
Customizations location is defined in configuration.php with following setting:
$CONFIGURATION = array(
"customizations_folder" => "/Applications/MAMP/htdocs/mollify/custom/backend/",
...
);
Now any text resources are first searched from this folder.
For example customizing LostPassword plugin texts:
- Copy "
backend/plugin/LostPassword/PluginLostPasswordMessages.txt" into customizations folder defined inconfiguration.php - Make your own modifications