[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/templates/cassiopeia/html/mod_menu/ -> dropdown-metismenu_url.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  $linktype = $item->title;
  31  
  32  if ($item->menu_icon) {
  33      // The link is an icon
  34      if ($itemParams->get('menu_text', 1)) {
  35          // If the link text is to be displayed, the icon is added with aria-hidden
  36          $linktype = '<span class="p-2 ' . $item->menu_icon . '" aria-hidden="true"></span>' . $item->title;
  37      } else {
  38          // If the icon itself is the link, it needs a visually hidden text
  39          $linktype = '<span class="p-2 ' . $item->menu_icon . '" aria-hidden="true"></span><span class="visually-hidden">' . $item->title . '</span>';
  40      }
  41  } elseif ($item->menu_image) {
  42      // The link is an image, maybe with an own class
  43      $image_attributes = [];
  44  
  45      if ($item->menu_image_css) {
  46          $image_attributes['class'] = $item->menu_image_css;
  47      }
  48  
  49      $linktype = HTMLHelper::_('image', $item->menu_image, $item->title, $image_attributes);
  50  
  51      if ($itemParams->get('menu_text', 1)) {
  52          $linktype .= '<span class="image-title">' . $item->title . '</span>';
  53      }
  54  }
  55  
  56  if ($item->browserNav == 1) {
  57      $attributes['target'] = '_blank';
  58      $attributes['rel']    = 'noopener noreferrer';
  59  
  60      if ($item->anchor_rel == 'nofollow') {
  61          $attributes['rel'] .= ' nofollow';
  62      }
  63  } elseif ($item->browserNav == 2) {
  64      $options = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,' . $params->get('window_open');
  65  
  66      $attributes['onclick'] = "window.open(this.href, 'targetWindow', '" . $options . "'); return false;";
  67  }
  68  
  69  echo HTMLHelper::link(OutputFilter::ampReplace(htmlspecialchars($item->flink, ENT_COMPAT, 'UTF-8', false)), $linktype, $attributes);
  70  
  71  if ($showAll && $item->deeper) {
  72      echo '<button class="mm-collapsed mm-toggler mm-toggler-link" aria-haspopup="true" aria-expanded="false" aria-label="' . $item->title . '"></button>';
  73  }


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