[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Joomla! Content Management System 5 * 6 * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10 namespace Joomla\CMS\Pathway; 11 12 use Joomla\CMS\Application\SiteApplication; 13 use Joomla\CMS\Factory; 14 use Joomla\CMS\Language\Multilanguage; 15 16 // phpcs:disable PSR1.Files.SideEffects 17 \defined('JPATH_PLATFORM') or die; 18 // phpcs:enable PSR1.Files.SideEffects 19 20 /** 21 * Class to manage the site application pathway. 22 * 23 * @since 1.5 24 */ 25 class SitePathway extends Pathway 26 { 27 /** 28 * Class constructor. 29 * 30 * @param SiteApplication $app Application Object 31 * 32 * @since 1.5 33 */ 34 public function __construct(SiteApplication $app = null) 35 { 36 $this->pathway = array(); 37 38 $app = $app ?: Factory::getContainer()->get(SiteApplication::class); 39 $menu = $app->getMenu(); 40 $lang = Factory::getLanguage(); 41 42 if ($item = $menu->getActive()) { 43 $menus = $menu->getMenu(); 44 45 // Look for the home menu 46 if (Multilanguage::isEnabled()) { 47 $home = $menu->getDefault($lang->getTag()); 48 } else { 49 $home = $menu->getDefault(); 50 } 51 52 if (\is_object($home) && ($item->id != $home->id)) { 53 foreach ($item->tree as $menupath) { 54 $link = $menu->getItem($menupath); 55 56 switch ($link->type) { 57 case 'separator': 58 case 'heading': 59 $url = null; 60 break; 61 62 case 'url': 63 if ((strpos($link->link, 'index.php?') === 0) && (strpos($link->link, 'Itemid=') === false)) { 64 // If this is an internal Joomla link, ensure the Itemid is set. 65 $url = $link->link . '&Itemid=' . $link->id; 66 } else { 67 $url = $link->link; 68 } 69 break; 70 71 case 'alias': 72 // If this is an alias use the item id stored in the parameters to make the link. 73 $url = 'index.php?Itemid=' . $link->getParams()->get('aliasoptions'); 74 break; 75 76 default: 77 $url = $link->link . '&Itemid=' . $link->id; 78 break; 79 } 80 81 $this->addItem($menus[$menupath]->title, $url); 82 } 83 } 84 } 85 } 86 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |