本文整理汇总了PHP中FlexicontentHelperRoute::_findItem方法的典型用法代码示例。如果您正苦于以下问题:PHP FlexicontentHelperRoute::_findItem方法的具体用法?PHP FlexicontentHelperRoute::_findItem怎么用?PHP FlexicontentHelperRoute::_findItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlexicontentHelperRoute
的用法示例。
在下文中一共展示了FlexicontentHelperRoute::_findItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItemRoute
//.........这里部分代码省略.........
if ( $type ) {
$type_menu_itemid_usage = $type->params->get('type_menu_itemid_usage', 0); // ZERO: do not use, 1: before item's category, 2: after item's category
$type_menu_itemid = $type->params->get('type_menu_itemid', 0);
if ($type_menu_itemid_usage && $type_menu_itemid) {
if ( !isset($type->typeMenuItem) ) {
$menus = JFactory::getApplication()->getMenu('site', array()); // this will work in J1.5 backend too !!!
$type->typeMenuItem = $menus->getItem( $type_menu_itemid );
}
}
}
// **********************************************************************************
// Get item's parent categores to be used in search a menu item of type category view
// **********************************************************************************
$parents_ids = array();
if ( $_catid && isset($globalcats[$_catid]->ancestorsarray) ) {
$parents_ids = array_reverse($globalcats[$_catid]->ancestorsarray);
}
// **********************************************************
// Create the needles for table lookup in descending priority
// **********************************************************
$needles = array();
// Priority 1: Item view menu items of given item ID
$needles[FLEXI_ITEMVIEW] = array($_id);
// Priority 2: Type's default before categories (if so configured): ... giving an object means no-lookup and just use it
if ($type && $type_menu_itemid_usage==1 && $type->typeMenuItem) $needles['type_before'] = $type->typeMenuItem;
// Priority 3: Category view menu items of given category IDs ... item's category and its parent categories in ascending order
$needles['category'] = $parents_ids;
// Priority 4: Directory view menu items ... pointing to same category IDs as above
$needles['flexicontent'] = $needles['category'];
// Priority 5: Type's default after categories (if so configured): ... giving an object means no-lookup and just use it
if ($type && $type_menu_itemid_usage==2 && $type->typeMenuItem) $needles['type_after'] = $type->typeMenuItem;
// Do not add component's default menu item to allow trying "ALL" language items ? before component default ?
// Other data to pass to _findItem()
$data = array();
$data['item'] = $item;
// ***************
// Create the link
// ***************
// view
$link = 'index.php?option=com_flexicontent&view='.FLEXI_ITEMVIEW;
// category id
if ($catid) $link .= '&cid='.$catid;
// item id
$link .= '&id='. $id;
// use SEF language code as so configured
$data['language'] = '*'; // Default to ALL
if ($use_language && $language && $language != "*")
{
if(isset(self::$lang_lookup[$language]))
{
if ( self::$add_url_lang && isset(self::$interface_langs[$language]) ) {
$link .= '&lang='.self::$lang_lookup[$language];
}
$data['language'] = $language;
}
}
// *************************************************
// Finally find the menu item id (best match) to use
// *************************************************
// USE the itemid provided, if we were given one it means it is "appropriate and relevant"
if ($Itemid) {
$link .= '&Itemid='.$Itemid;
}
// Try to find the most appropriate/relevant menu item, using the priority set via needles array
else if ($menuitem = FlexicontentHelperRoute::_findItem($needles, $data)) {
$link .= '&Itemid='.$menuitem->id;
}
// Try to use component's default menu item, this is according to COMPONENT CONFIGURATION and includes ACTIVE menu item if appropriate
else {
if ($component_default_menuitem_id === null)
$component_default_menuitem_id = FlexicontentHelperRoute::_setDefaultMenuitemId();
if ($component_default_menuitem_id)
$link .= '&Itemid='.$component_default_menuitem_id;
}
return $link;
}