MINOR Partially reverted r99079 - SiteTree->getNavigatorItems() was refactored to SilverStripeNavigator::get_for_record() (from r99081)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102840 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-14 04:04:44 +00:00
parent fc6ffa5e94
commit 65473615d9

View File

@ -1847,56 +1847,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
return $fields; return $fields;
} }
function getNavigatorItems() {
Requirements::css(SAPPHIRE_DIR . '/css/SilverStripeNavigator.css');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
// Requirements::javascript(THIRDPARTY_DIR . '/prototype.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-livequery/jquery.livequery.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/SilverStripeNavigator.js');
$items = '';
$message = '';
$link = '';
$navItemClasses = ClassInfo::subclassesFor('SilverStripeNavigatorItem');
array_shift($navItemClasses);
// Sort menu items according to priority
$menuPriority = array();
$i = 0;
foreach($navItemClasses as $navItemClass) {
if($navItemClass == 'SilverStripeNavigatorItem') continue;
$i++;
$obj = new $navItemClass();
// This funny litle formula ensures that the first item added with the same priority will be left-most.
$priority = Object::get_static($navItemClass, 'priority');
$menuPriority[$priority * 100 - 1] = $obj;
}
ksort($menuPriority);
foreach($menuPriority as $obj) {
$text = $obj->getHTML($this);
if($text) $items .= $text;
$newMessage = $obj->getMessage($this);
if($newMessage) $message = $newMessage;
$newLink = $obj->getLink($this);
if($newLink) $link = $newLink;
}
if($link) {
$data = new ArrayData(array('Link' => $link));
$items .= $data->renderWith(array('SilverStripeNavigatorLink'));
}
return array(
'items' => $items,
'message' => $message
);
}
/** /**
* *
* @param boolean $includerelations a boolean value to indicate if the labels returned include relation fields * @param boolean $includerelations a boolean value to indicate if the labels returned include relation fields