This is an OXID module to automically manage the order of class extensions in OXID. It will create a new entry in the OXID admin navigation, where you can configure the class extension order of your modules.
A demonstration can be found at http://oxid-demo.kyoya.de/. The database there is restored every hour.
To log-in into the OXID-Demo admin use this credentials:
- Username:
oxid-admin
- Password:
oxid-admin
The module must be installed to /path/to/modules/kyoya-de/metached
.
Please ensure that the file /path/to/modules/kyoya-de/vendormetadata.php
exists,
otherwise OXID won't recognize the module.
- Install
composer
(follow the installation instructions). - Create a
composer.json
with this content (or add it, if you have thecomposer.json
already):{ "require": { "kyoya-de/metached":"^1.0" }, "extra":{ "installer-paths": { "modules/{$vendor}/{$name}": ["type:oxid-module"] } } }
- Run
composer install
(orcomposer update
if you have already acomposer.json
).
- Download the release package from the releases Page.
- Create the module directory
/path/to/modules/kyoya-de/metached
. - Extract all files from the archive to the module directory.
Activate the module in the OXID admin.
Now you can start to configure the order of OXID class extensions.
There is no configuration required. But the module provides a global setting to define where to sort unconfigured module extensions. This setting is also available for each overwritten class on the configuration page of the module.
This page can be found in the OXID admin under Extensions / Metached configuration. Here you can configure the overwrite order of all your extensions, plus where to put unknown overwritten classes. For better usability the classes are grouped. You can select between two group types:
- First letter: This will group the base classes by its first letter.
For example: if the class name is
ManufacturerList
it will be found underM
. - Object type: This will group the classes by there type. This type is defined as follows (will be detected in this order):
oxAdminDetails
: Admin Details ControlleroxAdminList
: Admin List ControlleroxAdminView
: Admin Generic ControllerajaxListComponent
: Admin Ajax ComponentoxWidget
: WidgetoxUBase
: ControlleroxBase
: ModeloxView
: Component- Any other class: Other
The groups itself are sorted alphabetically by the translated title.
In each group you can sort the overwrites for each class. It is also possible to set where to put unknown extensions per class.
OXIDs extend
definitions are hidden, only module titles will be displayed.
If you change the order it will be saved without the need to press a button. Same for the position of unknown extensions.
A small box will be displayed to show you the result of the save action. It will automatically disappear after 3 seconds.
As long as you do not change anything, nothing will be saved. Only changes made to a class will be saved. The initial configuration is created at the first module activation.
Important: After you've changed the order, you must clear OXIDs module cache and re-activate one of the affected modules.
When a module is going to be activated, OXID merges the extensions of the new module with the existing ones. Metached sorts the resulting array after OXIDs merge. As the sorting algorithm merge sort is used. We can't use PHPs built-in usort function, because it seems to be a quicksort implementation. Quicksort is not a stable sorting algorithm, so it is not usable for us. Quicksort does not guarantee that the order of equal elements is not changed. If we would use it, OXIDs extension may change on every module activation.
This piece of software is released under the MIT license. Take a look at the LICENSE file.
Feel free to copy and change the code, but never remove the original author! Pull requests are also welcome.