Jump to content

Alphabetic add-on list (admin)


Karamellwuerfel

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...