本文整理汇总了PHP中FlexicontentHelperRoute::_loadItem方法的典型用法代码示例。如果您正苦于以下问题:PHP FlexicontentHelperRoute::_loadItem方法的具体用法?PHP FlexicontentHelperRoute::_loadItem怎么用?PHP FlexicontentHelperRoute::_loadItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlexicontentHelperRoute
的用法示例。
在下文中一共展示了FlexicontentHelperRoute::_loadItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItemRoute
/**
* Get routed links for content items
*/
static function getItemRoute($id, $catid = 0, $_Itemid = 0, $item = null)
{
$Itemid = $_Itemid == -1 ? 0 : $_Itemid;
// -1 indicates to return the found menu Itemid instead of the produced link
static $component_default_menuitem_id = null;
// Calculate later only if needed
static $current_language = null;
if ($current_language === null) {
$current_language = JFactory::getLanguage()->getTag();
// Current language tag for J2.5+ but not for J1.5
}
static $use_language = null;
if ($use_language === null) {
$use_language = JLanguageMultilang::isEnabled();
if ($use_language) {
self::_buildLanguageLookup();
}
}
global $globalcats;
$_catid = (int) $catid;
$_id = (int) $id;
// *****************************************************************
// Get data of the FLEXIcontent item (only if not already given)
// including data like: type id, language, but do not do 1 SQL query
// per item, to get the type id and language ...
// for language we will use current language, for type_id, we ignore
// *****************************************************************
// Compatibility with calls not passing item data, check for item data in global object, avoiding an extra SQL call
if (!$item) {
$item = FlexicontentHelperRoute::_loadItem($_id, $doQuery = false);
}
// Get language
$language = !$item || @(!$item->language) ? $current_language : $item->language;
// Get type ID
$type_id = $item && isset($item->type_id) ? $item->type_id : 0;
// Get type data
static $types = null;
if ($type_id && $types === null) {
$types = FlexicontentHelperRoute::_getTypeParams();
}
$type = $type_id && isset($types[$type_id]) ? $types[$type_id] : false;
// *****************************************************************
// DONE ONCE (per encountered type): Get content type's default menu
// *****************************************************************
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
//.........这里部分代码省略.........