1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-25 17:01:43 +02:00

Allow theme to manually control navigation 'active' status with new method: e107::nav('active', [url match]);

This commit is contained in:
Cameron
2021-07-14 12:18:42 -07:00
parent ccf0f037aa
commit 099dffdfdd
2 changed files with 26 additions and 1 deletions

View File

@@ -2587,6 +2587,21 @@ class e107
self::getJs()->addLink($attributes, $browserCache);
}
/**
* @param string $type eg. 'active'
* @param mixed $value eg. existing link-url value.
*/
public static function nav($type, $value=null)
{
if($value === null)
{
return e107::getRegistry('core/e107/navigation/'.$type);
}
return e107::setRegistry('core/e107/navigation/'.$type, $value);
}
/**
* CSS Common Public Function. Prefered is shortcode script path

View File

@@ -1872,9 +1872,19 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
{
return true;
}
// New e107 v.2.3.1 - using e107::nav('active', link url);
$manualOverride = e107::getRegistry('core/e107/navigation/active');
if(!empty($manualOverride) && empty($data['link_sub']))
{
if(strpos($data['link_url'], $manualOverride) !==false)
{
return true;
}
}
// XXX Temporary Fix - TBD.
// XXX Temporary Fix - @deprecated.
// Set the URL matching in the page itself. see: forum_viewforum.php and forum_viewtopic.php
if(defined("NAVIGATION_ACTIVE") && empty($data['link_sub']))
{