Jump to content
Karamellwuerfel

Alphabetic add-on list (admin)

Recommended Posts

You need to edit the MainController.class.php. You'll find it here:

\core\classes\MainController.class.php

In line 96 there's a function called loadModules(). Edit this function to the following:

public static function loadModules()
{
    global $NAVBAR;
    global $HTMLHead;
    
    self::$ModuleList = self::getModulesFromPath(CODON_MODULES_PATH);

    if(empty(self::$ModuleList))
    {
        Debug::showCritical('No modules were found in module path! ('.CODON_MODULES_PATH.')');
        return;
    }
    
    self::$listSize = sizeof(self::$ModuleList);
    self::$keys = array_keys(self::$ModuleList);

    ksort(self::$ModuleList);

    foreach (self::$ModuleList as $module_name => $module_controller) {
        $ModuleName = $module_name;
        $ModuleController = $module_controller;

        if(file_exists($ModuleController))
        {
            include_once $ModuleController;

            if(class_exists($ModuleName))
            {
                $ModuleName = strtoupper($ModuleName);
                global $$ModuleName;

                $$ModuleName = new $ModuleName();
                $$ModuleName->init($ModuleName); // Call the parent constructor

                if(self::$activeModule == $ModuleName)
                {
                    # Skip it for now, run it last since it's the active
                    #	one, and may overwrite some other parameters
                    continue;
                }
                else
                {
                    ob_start();
                    self::Run($ModuleName, 'NavBar');
                    $NAVBAR .= ob_get_clean();

                    self::Run($ModuleName, 'HTMLHead');
                    $HTMLHead .= ob_get_clean();

                    @ob_end_clean();
                }
            }
        }
    }
        
    # Run the init tasks
    ob_start();
    self::Run(self::$activeModule, 'NavBar');
    $NAVBAR .= ob_get_clean();
    
    self::Run(self::$activeModule, 'HTMLHead');
    $HTMLHead .= ob_get_clean();
    
    @ob_end_clean();
}

Voilà. You now have a alphabetic sorted Module list in your admin area.

  • Thanks 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×