[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/templates/cassiopeia/html/mod_menu/ -> dropdown-metismenu_component.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  mod_menu
   6   *
   7   * @copyright   (C) 2020 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\Filter\OutputFilter;
  14  use Joomla\CMS\HTML\HTMLHelper;
  15  
  16  $attributes = [];
  17  
  18  if ($item->anchor_title) {
  19      $attributes['title'] = $item->anchor_title;
  20  }
  21  
  22  if ($item->anchor_css) {
  23      $attributes['class'] = $item->anchor_css;
  24  }
  25  
  26  if ($item->anchor_rel) {
  27      $attributes['rel'] = $item->anchor_rel;
  28  }
  29  
  30  if ($item->id == $active_id) {
  31      $attributes['aria-current'] = 'location';
  32  
  33      if ($item->current) {
  34          $attributes['aria-current'] = 'page';
  35      }
  36  }
  37  
  38  $linktype = $item->title;
  39  
  40  if ($item->menu_icon) {
  41      // The link is an icon
  42      if ($itemParams->get('menu_text', 1)) {
  43          // If the link text is to be displayed, the icon is added with aria-hidden
  44          $linktype = '<span class="p-2 ' . $item->menu_icon . '" aria-hidden="true"></span>' . $item->title;
  45      } else {
  46          // If the icon itself is the link, it needs a visually hidden text
  47          $linktype = '<span class="p-2 ' . $item->menu_icon . '" aria-hidden="true"></span><span class="visually-hidden">' . $item->title . '</span>';
  48      }
  49  } elseif ($item->menu_image) {
  50      // The link is an image, maybe with an own class
  51      $image_attributes = [];
  52  
  53      if ($item->menu_image_css) {
  54          $image_attributes['class'] = $item->menu_image_css;
  55      }
  56  
  57      $linktype = HTMLHelper::_('image', $item->menu_image, $item->title, $image_attributes);
  58  
  59      if ($itemParams->get('menu_text', 1)) {
  60          $linktype .= '<span class="image-title">' . $item->title . '</span>';
  61      }
  62  }
  63  
  64  if ($item->browserNav == 1) {
  65      $attributes['target'] = '_blank';
  66  } elseif ($item->browserNav == 2) {
  67      $options = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes';
  68  
  69      $attributes['onclick'] = "window.open(this.href, 'targetWindow', '" . $options . "'); return false;";
  70  }
  71  
  72  echo HTMLHelper::link(OutputFilter::ampReplace(htmlspecialchars($item->flink, ENT_COMPAT, 'UTF-8', false)), $linktype, $attributes);
  73  
  74  if ($showAll && $item->deeper) {
  75      echo '<button class="mm-collapsed mm-toggler mm-toggler-link" aria-haspopup="true" aria-expanded="false" aria-label="' . $item->title . '"></button>';
  76  }


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