[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/layouts/joomla/toolbar/ -> dropdown.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  Layout
   6   *
   7   * @copyright   (C) 2018 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\Factory;
  14  use Joomla\CMS\HTML\HTMLHelper;
  15  use Joomla\CMS\Language\Text;
  16  
  17  extract($displayData, EXTR_OVERWRITE);
  18  
  19  /**
  20   * Layout variables
  21   * -----------------
  22   * @var   string  $id
  23   * @var   string  $onclick
  24   * @var   string  $class
  25   * @var   string  $text
  26   * @var   string  $btnClass
  27   * @var   string  $tagName
  28   * @var   string  $htmlAttributes
  29   * @var   string  $hasButtons
  30   * @var   string  $button
  31   * @var   string  $dropdownItems
  32   * @var   string  $caretClass
  33   * @var   string  $toggleSplit
  34   */
  35  
  36  $direction = Factory::getLanguage()->isRtl() ? 'dropdown-menu-end' : '';
  37  
  38  ?>
  39  
  40  <?php if ($hasButtons && trim($button) !== '') : ?>
  41      <?php // If there is a toggle split then render the items. Else render the parent button which has the items in the custom element.  ?>
  42      <?php if ($toggleSplit ?? true) : ?>
  43          <?php HTMLHelper::_('bootstrap.dropdown', '.dropdown'); ?>
  44          <?php // @todo use a class instead of the inline style.
  45               //  Reverse order solves a console err for dropdown ?>
  46          <div id="<?php echo $id; ?>" class="btn-group dropdown-<?php echo $name ?? ''; ?>" role="group">
  47              <button type="button" class="<?php echo $caretClass ?? ''; ?> dropdown-toggle-split"
  48                  data-bs-toggle="dropdown" data-bs-target=".dropdown-menu" data-bs-display="static" aria-haspopup="true" aria-expanded="false">
  49                  <span class="visually-hidden"><?php echo Text::_('JGLOBAL_TOGGLE_DROPDOWN'); ?></span>
  50                  <span class="icon-chevron-down" aria-hidden="true"></span>
  51              </button>
  52  
  53              <?php echo $button; ?>
  54  
  55              <?php if (trim($dropdownItems) !== '') : ?>
  56                  <div class="dropdown-menu <?php echo $direction; ?>">
  57                      <?php echo $dropdownItems; ?>
  58                  </div>
  59              <?php endif; ?>
  60          </div>
  61      <?php else : ?>
  62          <?php echo $button; ?>
  63      <?php endif; ?>
  64  <?php endif; ?>


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