[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/modules/mod_menu/tmpl/ -> default_heading.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  mod_menu
   6   *
   7   * @copyright   (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\HTML\HTMLHelper;
  14  
  15  $title      = $item->anchor_title ? ' title="' . $item->anchor_title . '"' : '';
  16  $anchor_css = $item->anchor_css ?: '';
  17  $linktype   = $item->title;
  18  
  19  if ($item->menu_icon) {
  20      // The link is an icon
  21      if ($itemParams->get('menu_text', 1)) {
  22          // If the link text is to be displayed, the icon is added with aria-hidden
  23          $linktype = '<span class="p-2 ' . $item->menu_icon . '" aria-hidden="true"></span>' . $item->title;
  24      } else {
  25          // If the icon itself is the link, it needs a visually hidden text
  26          $linktype = '<span class="p-2 ' . $item->menu_icon . '" aria-hidden="true"></span><span class="visually-hidden">' . $item->title . '</span>';
  27      }
  28  } elseif ($item->menu_image) {
  29      // The link is an image, maybe with its own class
  30      $image_attributes = [];
  31  
  32      if ($item->menu_image_css) {
  33          $image_attributes['class'] = $item->menu_image_css;
  34      }
  35  
  36      $linktype = HTMLHelper::_('image', $item->menu_image, $item->title, $image_attributes);
  37  
  38      if ($itemParams->get('menu_text', 1)) {
  39          $linktype .= '<span class="image-title">' . $item->title . '</span>';
  40      }
  41  }
  42  
  43  ?>
  44  <span class="mod-menu__heading nav-header <?php echo $anchor_css; ?>"<?php echo $title; ?>><?php echo $linktype; ?></span>


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer