Permalink
Browse files

feature(views): Allow sites to specify views.php at root

When you install elgg via composer, you can already use the root directory like a plugin,
but without a manifest.xml and it cannot be disabled. Plugins can use a views.php
in their root to define custom view mappings, so it makes sense for you to use this in
your site's root as well.
  • Loading branch information...
ewinslow committed Aug 5, 2015
1 parent 0886702 commit 625c1dddfc4bc6f65a2f6bd5555b805dcd4a2495
Showing with 8 additions and 0 deletions.
  1. +8 −0 engine/classes/Elgg/Application.php
@@ -258,6 +258,14 @@ public function bootCore() {
// Elgg is installed as a composer dep, so try to treat the root directory
// as a custom plugin that is always loaded last and can't be disabled...
if (!elgg_get_config('system_cache_loaded')) {
$viewsFile = Directory\Local::root()->getFile('views.php');
if ($viewsFile->exists()) {
$viewsSpec = $viewsFile->includeFile();
if (is_array($viewsSpec)) {
_elgg_services()->views->mergeViewsSpec($viewsSpec);
}
}
_elgg_services()->views->registerPluginViews(Directory\Local::root()->getPath());
}

0 comments on commit 625c1dd

Please sign in to comment.