Documentation [V9.2]
Developer Notes
Documentation [V9.2]
It's easy to integrate custom modifications and/or themes with PHP Pro Bid V9.
All custom code modifications can now be done by overriding or extending files – see the table below:
| OVERRIDE | EXTEND | |
|---|---|---|
| Classes | Yes | |
| View Files | Yes | |
| Controllers | Yes | Yes |
| PHP Lang Files | Yes | |
| Navigation XML Files | Yes | |
| Module Config Files | Yes |
Detailed Information
Most modified files, excepting theme specific view files, will be added in a newly created /addons/ folder, and will be automatically parsed by the software. A file in the /addons/ 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 same folder as in stock, but in the /addons/
folder, for example, the parsing order will be:
/addons/custom/library/Ppb/Model/Elements/Listing.php overrides
/library/Ppb/Model/Elements/Listing.php
The software will recognize the newly overridden class 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 /addons/ folder or stock view files. For example:
/themes/your-theme/members/summary/index.phtml overrides
/addons/custom/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
/addons/custom/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
/addons/custom/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. 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 /addons/
folder, for example:
/addons/custom/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
5. 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',
),
),
),
);