Changes to project files
Making individual changes to files and code that is responsible for the product's logic can lead to a situation where standard updates are not available due to possible loss of data changes. To minimize such situations, there are several mechanisms available that exclude making changes to standard application code while maintaining flexibility for modifying it.
To work with template files (php), you can create your own themes. In addition to template files, you can also make changes to JavaScript / CSS files and image files.
To modify and enhance functions (PHP code), it is optimal to create your own plugin, which allows you to extend existing functions using the hooks and filters system, as well as other tools.
To add content to platform pages version 3.x, you need to use blocks.
These mechanisms allow you to make changes to all project files while minimizing conflicts when new updates are released. If you made changes to product files directly (not through a theme/plugin), all your changes will be lost when installing an update.
Changes to add-on files
In case you need to make changes to existing add-ons, there is a mechanism for customizing files - the ability to replace files by copying them to a special directory /custom/ and then editing them. The file nesting structure should be preserved.
Example of customizing PHP files (code and templates) of a plugin:
Path to the source file of the plugin where changes are needed - /plugins/pluginDir/pluginFile.php
Path to the copied file for editing - /custom/plugins/pluginDir/pluginFile.php
You can see that the nested directory structure remained the same when copying the file to the customization directory, similar to the original file location.
Example of customizing static files (JS/CSS/images) of a plugin:
Path to the source file of the plugin where changes are needed - /public_html/plugins/pluginDir/static/file.js
Path to the copied file for editing - /public_html/custom/plugins/pluginDir/static/file.js
The same approach applies to theme files.
Note that with the release and installation of add-on updates, the modified files will not contain updates. Read more about how to get a list of changes made to a theme during an update here.
If you made changes to add-on files directly (without using the customization mechanism), all your changes will be lost when installing an update.
System settings
Many project settings, such as the number of entries in lists or pre-/post-moderation, can be configured in the "Site Settings / System Settings" section. In the code, they usually look like this:
config::sysAdmin('contacts.captcha', true, TYPE_BOOL);
config::sys('contacts.captcha', true, TYPE_BOOL);
The second parameter represents the default value. Do not change it in the code. Look for the corresponding setting in the admin panel, or if it doesn't exist, add a line to the system settings file /config/sys.php.
As an example, let's change the value to false
:
'contacts.captcha' => false,
In most forms, you can find a string length limitation when validating incoming data. For example:
'name' => array(TYPE_NOTAGS, 'len' => 50, 'len.sys' => 'form.name.limit'),
In the example, the text entered in the name
field will be truncated to 50 characters. The len.sys
parameter indicates that this value can be overridden using a system setting. To extend it to 100 characters, add the following line to the system settings file /config/sys.php:
'form.name.limit' => 100,
The value of the setting retrieved using config::sys
will be taken from the system settings file /config/sys.php, and the config::sysAdmin
call will first check if the value was specified in the admin panel, in the "Site Settings / System Settings" section. If not, it will check the system settings file.
Read more about the available types of settings in the article "Application Settings".
Interface Localization
If you need to change some phrases in the interface, such as button names, field names, form titles, and the like, do not edit the files. Use the Localization function for this. You can find more detailed documentation in the "Site Settings / Localization" section of the product.
Also, remember that most H1 headings on pages are edited in the corresponding SEO settings.
Localization of extensions is done using the built-in lang
and langAdmin
functions, details can be found here.
Read more about application localization in the "Application Localization" section.