Path

ez projects / nxc_extensions


NXC Extensions

UNIX name Owner Status Version Compatible with
nxc_extensions Serhey Dolgushev stable N/A 4x
Current extension allows:
- set order to all other extensions (you can use drag and drop, clicking by extension`s name)
- set dependencies between the extensions
- use install/uninstall extension triggers, and put any PHP code into them

How to install:

  1. Download file
  2. Unpack it to <path_to_ez_publish_root>/extension directory
  3. Login in eZ Publish Admin area and open the "Settings" tab
  4. Click on extensions link in the left menu
  5. Activate nxc_extensions and nxc_mootools (you can skip nxc_mootools, but in this case you will be not able to use drag&drop for setting extensions order, you should set the order manually)

How it works:

After nxc_extensions activation, left menu template in setup tab will be overrided and "Extensions" link will link to nxc_extensions/extensions (not setup/extensions), but you still can use setup/extensions if you wish.At nxc_extensions/extensions view there are a list of extensions, and now you can drag them and change their order. If you didn`t activate nxc_mootols extensions, there are an order input for each extenson, and you can fill it with integer numbers. Extensions with the biggest order will be at the bottom of extensions list. Extensions which are at the bottom are included last, so they can override settings of previously extensions.

How to set dependencies and install/uninstall triggers:

There are a couple of test extensions in the archive:

  1. nxc_test_order_1
  2. nxc_test_order_2
  3. nxc_test_order_3

You can investigate them. But i will try to explain how it works: you should create settings.php file in the root directory of extensions (for example let it be test_extension). So you get <path_to_ez_publish_root>/extension/test_extension/settings.php. This file should contain a declaration of class which extends nxcExtensionSettings (this one is available at <path_to_ez_publish_root>/extension/nxc_extensions/classes/nxcextensionsettings.php). The class name should be like <extension_name>Settings. So we get the settings file:

<?php
class test_extensionSettings extends nxcExtensionSettings {
 
    // default order of current extension
    public $defaultOrder = 20;
 
    // array of extensions that affect the current (you can`t activate current extension, if at least on of them isn`t activated)
    public $dependencies = array( 'test_extension_2', 'test_extension_3' );
 
    public function activate() {
        // here you can put any php code which will be executed when extension will be installed
        eZDebug::writeDebug( 'Extension ' . $this->name . ' activated' );
    }
 
    public function deactivate() {
        // here you can put any php code which will be executed when extension will be uninstalled
        eZDebug::writeDebug( 'Extension ' . $this->name . ' deactivated' );
    }
}
?>

You should notice: when you are disabling any extension, all other extensions which depend on current, will be disabled automatically

Screenshot

No news yet.

This project has no reviews yet. Be the first one to review it!