File Overrides
As the name implies, file overrides allow replacing an entire file with a customized version. This is the approach used for templates, and it also works with PHP files.
Overview
While overriding an entire file provides lots of flexibility in the changes you can make, it's preferable, whenever possible, to use one of the other development tools (hooks, events, and macros), because these are easier to maintain.
Getting Started
You can override practically any PHP file in JReviews and Add-ons by copying the file to overrides using the same file structure found in the source.
The PHP overrides work just like the template overrides and view helper overrides.
Below you can find some examples of the original files on the left, and the corresponding override on the right.
For Joomla, the left hand-side starts at components/com_jreviews
, while for WordPress it's wp-content/plugins/jreviews
.
Source
jreviews/
`-- controllers/
| `-- categories_controller.php
`-- models/
`-- media.php
Overrides
jreviews_overrides/
`-- controllers/
| `-- categories_controller.php
`-- models/
`-- media.php
Disabling Overrides
For troubleshooting purposes after making changes, or after an update, you can prevent JReviews from loading any of the code in overrides and instead use the core files. You can find the Disable Overrides
setting in Configuration Settings → General
.
Dealing With Customizations After Updates
To find out what you need to know about dealing with customizations after updates, read There's an update - Now what?.