Added the possibility for themes to override core module functions
This commit is contained in:
parent
acefb84681
commit
48e6ff21aa
|
@ -59,7 +59,19 @@ The same rule applies to the JavaScript files found in
|
||||||
|
|
||||||
they will be overwritten by files in
|
they will be overwritten by files in
|
||||||
|
|
||||||
/view/theme/**your-theme-name**/js.
|
/view/theme/**your-theme-name**/js
|
||||||
|
|
||||||
|
### Modules
|
||||||
|
|
||||||
|
You have the freedom to override core modules found in
|
||||||
|
|
||||||
|
/mod
|
||||||
|
|
||||||
|
They will be overwritten by files in
|
||||||
|
|
||||||
|
/view/theme/**your-theme-name**/mod
|
||||||
|
|
||||||
|
Be aware that you can break things easily here if you don't know what you do. Also notice that you can override parts of the module – functions not defined in your theme module will be loaded from the core module.
|
||||||
|
|
||||||
## Expand an existing Theme
|
## Expand an existing Theme
|
||||||
|
|
||||||
|
@ -288,4 +300,4 @@ The default file is in
|
||||||
/view/default.php
|
/view/default.php
|
||||||
|
|
||||||
if you want to change it, say adding a 4th column for banners of your favourite FLOSS projects, place a new default.php file in your theme directory.
|
if you want to change it, say adding a 4th column for banners of your favourite FLOSS projects, place a new default.php file in your theme directory.
|
||||||
As with the theme.php file, you can use the properties of the $a variable with holds the friendica application to decide what content is displayed.
|
As with the theme.php file, you can use the properties of the $a variable with holds the friendica application to decide what content is displayed.
|
||||||
|
|
11
index.php
11
index.php
|
@ -233,7 +233,16 @@ if(strlen($a->module)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If not, next look for a 'standard' program module in the 'mod' directory
|
* If not, next look for module overrides by the theme
|
||||||
|
*/
|
||||||
|
|
||||||
|
if((! $a->module_loaded) && (file_exists("view/theme/" . current_theme() . "/mod/{$a->module}.php"))) {
|
||||||
|
include_once("view/theme/" . current_theme() . "/mod/{$a->module}.php");
|
||||||
|
// We will not set module_loaded to true to allow for partial overrides.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finally, look for a 'standard' program module in the 'mod' directory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if((! $a->module_loaded) && (file_exists("mod/{$a->module}.php"))) {
|
if((! $a->module_loaded) && (file_exists("mod/{$a->module}.php"))) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user