本文整理汇总了PHP中Varien_Data_Tree_Node::setIsActive方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Tree_Node::setIsActive方法的具体用法?PHP Varien_Data_Tree_Node::setIsActive怎么用?PHP Varien_Data_Tree_Node::setIsActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Tree_Node
的用法示例。
在下文中一共展示了Varien_Data_Tree_Node::setIsActive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _injectLinks
/**
* Inject links into the top navigation
*
* @param Mage_Core_Model_Resource_Db_Collection_Abstract $items
* @param Varien_Data_Tree_Node $parentNode
* @return bool
*/
protected function _injectLinks($items, $parentNode)
{
if (!$parentNode) {
return false;
}
foreach ($items as $item) {
if (!$item->canIncludeInMenu()) {
continue;
}
$children = $item->getSplashPages();
if ($children && count($children->addOrderByName()->addFieldToFilter('include_in_menu', 1)->load()) === 0) {
continue;
}
$data = array('name' => $item->getName(), 'id' => $item->getMenuNodeId(), 'url' => $item->getUrl(), 'is_active' => $item->isActive());
if ($data['is_active']) {
$parentNode->setIsActive(true);
$buffer = $parentNode;
while ($buffer->getParent()) {
$buffer = $buffer->getParent();
$buffer->setIsActive(true);
}
}
$itemNode = new Varien_Data_Tree_Node($data, 'id', $parentNode->getTree(), $parentNode);
$parentNode->addChild($itemNode);
if ($children) {
$this->_injectLinks($children, $itemNode);
}
}
return true;
}
示例2: _injectLinks
/**
* Inject links into the top navigation
*
* @param Fishpig_Wordpress_Model_Resource_Menu_Item_Collection $items
* @param Varien_Data_Tree_Node $parentNode
* @return bool
*/
protected function _injectLinks($items, $parentNode)
{
if (!$parentNode) {
return false;
}
foreach ($items as $item) {
try {
$nodeId = 'wp-node-' . $item->getId();
$data = array('name' => $item->getLabel(), 'id' => $nodeId, 'url' => $item->getUrl(), 'is_active' => $item->isItemActive());
if ($data['is_active']) {
$parentNode->setIsActive(true);
$buffer = $parentNode;
while ($buffer->getParent()) {
$buffer = $buffer->getParent();
$buffer->setIsActive(true);
}
}
$itemNode = new Varien_Data_Tree_Node($data, 'id', $parentNode->getTree(), $parentNode);
$parentNode->addChild($itemNode);
if (count($children = $item->getChildrenItems()) > 0) {
$this->_injectLinks($children, $itemNode);
}
} catch (Exception $e) {
Mage::helper('wordpress')->log($e->getMessage());
}
}
return true;
}