Developer Notes

Starting with v7.4,  we made several code modifications to help mod developers easier integrate custom modifications and / or themes.

We added certain hooks so that none of the stock files will need editing. All custom code modifications can now be done by overriding or extending files – see table below:

OVERRIDE EXTEND
Classes Yes
View Files Yes
Controllers Yes Yes
PHP Lang Files * Yes
Navigation XML Files Yes
Module Config Files Yes

* Not yet available. To be implemented in V7.5.

Detailed Information

Most modified files, excepting theme specific view files, will be added in a newly created /mods/ folder, and will be automatically parsed by the software. A file in the /mods/ folder will take precedence over its counterpart in one of the stock folders.

1. Classes

All classes can be overridden by copying the original class in the exact same folder as in stock, but in the /mods/ folder, for example, the parsing order will be:
/mods/library/Ppb/Model/Elements/Listing.php overrides
/library/Ppb/Model/Elements/Listing.php

The newly overridden class will be recognized by the software as the class to use, and its corresponding stock file won't be used unless the modified class is removed.

2. View Files

View files, including view partials, will work similarly to the rule for classes. However, theme specific view files will take precedence over files in the /mods/ folder or stock view files. For example:
/themes/your-theme/members/summary/index.phtml overrides
/mods/module/Members/view/members/summary/index.phtml which overrides
/module/Members/view/members/summary/index.phtml

Example for view partials (applies to navigation and form partials as well):
/themes/your-theme/partials/pagination.phtml overrides
/mods/module/App/view/partials/pagination.phtml which overrides
/module/App/view/partials/pagination.phtml

3. Controllers

Controllers can be overridden just like any class, as explained in paragraph #1, but they can also be extended. Consequently, the extended controller class will have to be named as Extended extends . For example:
/mods/module/App/src/App/Controller/PagesExtended.php will extend:
/module/App/src/App/Controller/Pages.php and the class will be defined as:
class PagesExtended extends Pages

4. PHP Lang Files

* Not yet available. To be implemented in V7.5.

5. Navigation XML Files

Navigating XML files can be extended by adding data to the original xml structure. You can also override data from the original structure. To extend a navigation file, create the same file in the /mods/ folder, for example:
/mods/module/App/config/data/navigation/navigation.xml will extend:
/module/App/config/data/navigation/navigation.xml

Example - Adding a link to the header menu

In the new extended navigation file, add:


    
        
            
                
                    
                        
                        link/to/the/page
                    
                
            
        
    

6. Module Config Files

Module config files can be extended by replicating the array structure. It works similarly to how the navigation files are extended.

Example - Adding a new route
return array(
    'routes' => array(

        'app-custom-sample-route' => array(
            '/custom/sample/route',
            array(
                'controller' => 'custom',
                'action'     => 'sample',
            ),
        ),
    ),
);