Home » FeatureModule Admin Pages

FeatureModule Admin Pages

In order to give your FeatureModule an admin page(s) you need a Page.php file that looks something like this:

namespace SiteMap; // This naming must be consistent throughout

function Main(){
    $return = file_get_contents(MBX_BASE_SYSTEM_PATH.'/Modules/SiteMap/assets/templates/admin/SiteMap.html');
    $return = str_replace('{sitemap-index-url}', WPR_SITE_ROOT_URL.'SiteMapIndex.xml', $return);
    $return = str_replace('{sitemap-url}', WPR_SITE_ROOT_URL.'SiteMap.xml', $return);
    $return = str_replace('{cron_path}', MBX_BASE_SYSTEM_PATH.'/Modules/SiteMap/cron/SiteMapCron.php', $return);
    $return = str_replace('{cron_url}', '<a target="_new" href="'.WPR_SITE_ROOT_URL.'wpradmin/mbx/Modules/SiteMap/cron/SiteMapCron.php?key=8675309">'.WPR_SITE_ROOT_URL.'wpradmin/mbx/Modules/SiteMap/cron/SiteMapCron.php</a>', $return);
    $return .= $return .= "<script type='text/javascript' src='".MBX_WPR_AJAX_URL."Modules/SiteMap/script/admin-script.js'></script>";
    $return .= '<script>WPR.SiteMap = WPR.SiteMap || {};</script>';
    return new \Mbx\Page\PageReturn('SiteMap Setup', $return);
}

function GetAdminLinks(){
    $links = array();
    $links[] = array(
        'href' => WPR_ADMIN_SITE_ROOT.'index.php?apage=SiteMap&Feature=Main',
        'icon' => WPR_ICONS_BASEURL.'small/color/map.png',
        'text' => 'SiteMap Settings',
        'menu' => 'help');
    return $links;
}

Each page must have a function named the same as the feature in the admin link.
Your apage is always your FeatureModule name.

Currently the only menu choices are crm, map and help.

Name of author

Name: Mike Morris