MINOR ajshort: Updated CMSMenu to use Object::get_static() to get configuration information.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@79361 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-06-16 10:40:39 +00:00
parent fb6b248501
commit 02d9dd60e7

View File

@ -32,18 +32,17 @@ class CMSMenu extends Object implements Iterator, i18nEntityProvider
* when the item is removed. Functionality needed in {@link Director}. * when the item is removed. Functionality needed in {@link Director}.
*/ */
public static function add_controller($controllerClass) { public static function add_controller($controllerClass) {
// Get static bits $urlBase = Object::get_static($controllerClass, 'url_base');
$urlBase = eval("return $controllerClass::\$url_base;"); $urlSegment = Object::get_static($controllerClass, 'url_segment');
$urlSegment = eval("return $controllerClass::\$url_segment;"); $urlRule = Object::get_static($controllerClass, 'url_rule');
$urlRule = eval("return $controllerClass::\$url_rule;"); $urlPriority = Object::get_static($controllerClass, 'url_priority');
$urlPriority = eval("return $controllerClass::\$url_priority;"); $menuPriority = Object::get_static($controllerClass, 'menu_priority');
$menuPriority = eval("return $controllerClass::\$menu_priority;");
// Don't add menu items defined the old way // Don't add menu items defined the old way
if($urlSegment === null) return; if($urlSegment === null) return;
$link = Controller::join_links($urlBase,$urlSegment) . '/'; $link = Controller::join_links($urlBase, $urlSegment) . '/';
// Make director rule // Make director rule
if($urlRule[0] == '/') $urlRule = substr($urlRule,1); if($urlRule[0] == '/') $urlRule = substr($urlRule,1);
$rule = $link . '/' . $urlRule; // the / will combine with the / on the end of $link to make a // $rule = $link . '/' . $urlRule; // the / will combine with the / on the end of $link to make a //