Implemented a nav link generating system so that extension power what shows up in the menus rather than being hard-coded in the themes.

This commit is contained in:
Matthew Barbour
2019-08-02 14:54:48 -05:00
committed by matthew
parent 972b68bdd3
commit 00464d2579
38 changed files with 583 additions and 344 deletions

31
ext/system/main.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
/**
* Name: System
* Author: Matthew Barbour <matthew@darkholme.net>
* License: MIT
* Description: Provides system screen
*/
class System extends Extension
{
public function onPageRequest(PageRequestEvent $event)
{
global $page, $user;
if ($event->page_matches("system")) {
$e = new PageSubNavBuildingEvent("system");
send_event($e);
usort($e->links, "sort_nav_links");
$link = $e->links[0]->link;
$page->set_redirect($link->make_link());
$page->set_mode(PageMode::REDIRECT);
}
}
public function onPageNavBuilding(PageNavBuildingEvent $event)
{
$event->add_nav_link("system", new Link('system'), "System");
}
}