本文整理匯總了PHP中ElggMenuItem::getPriority方法的典型用法代碼示例。如果您正苦於以下問題:PHP ElggMenuItem::getPriority方法的具體用法?PHP ElggMenuItem::getPriority怎麽用?PHP ElggMenuItem::getPriority使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ElggMenuItem
的用法示例。
在下文中一共展示了ElggMenuItem::getPriority方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSetDataWithArray
public function testSetDataWithArray()
{
$item = new \ElggMenuItem('name', 'text', 'url');
$item->setData(array('priority' => 88, 'new' => 64));
$this->assertEquals(88, $item->getData('priority'));
$this->assertEquals(88, $item->getPriority());
$this->assertEquals(64, $item->getData('new'));
}
示例2: compareByWeight
/**
* Compare two menu items by their priority
*
* @param \ElggMenuItem $a Menu item
* @param \ElggMenuItem $b Menu item
* @return bool
* @deprecated 1.9 Use compareByPriority()
*/
public static function compareByWeight($a, $b)
{
elgg_deprecated_notice("\\ElggMenuBuilder::compareByWeight() deprecated by \\ElggMenuBuilder::compareByPriority", 1.9);
$aw = $a->getPriority();
$bw = $b->getPriority();
if ($aw == $bw) {
return $a->getData('original_order') - $b->getData('original_order');
}
return $aw - $bw;
}
示例3: compareByPriority
/**
* Compare two menu items by their priority
*
* @param \ElggMenuItem $a Menu item
* @param \ElggMenuItem $b Menu item
* @return bool
* @since 1.9.0
*/
public static function compareByPriority($a, $b)
{
$aw = $a->getPriority();
$bw = $b->getPriority();
if ($aw == $bw) {
return $a->getData('original_order') - $b->getData('original_order');
}
return $aw - $bw;
}