[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/layouts/joomla/toolbar/ -> basic.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\Language\Text;
  15  
  16  Factory::getDocument()->getWebAssetManager()
  17      ->useScript('core')
  18      ->useScript('webcomponent.toolbar-button');
  19  
  20  extract($displayData, EXTR_OVERWRITE);
  21  
  22  /**
  23   * Layout variables
  24   * -----------------
  25   * @var   int     $id
  26   * @var   string  $onclick
  27   * @var   string  $class
  28   * @var   string  $text
  29   * @var   string  $btnClass
  30   * @var   string  $tagName
  31   * @var   string  $htmlAttributes
  32   * @var   string  $task             The task which should be executed
  33   * @var   bool    $listCheck        Boolean, whether selection from a list is needed
  34   * @var   string  $form             CSS selector for a target form
  35   * @var   bool    $formValidation   Whether the form need to be validated before run the task
  36   * @var   string  $dropdownItems    The dropdown HTML
  37   * @var   string  $hasButtons
  38   * @var   string  $caretClass
  39   * @var   string  $toggleSplit
  40   */
  41  $tagName = $tagName ?? 'button';
  42  
  43  $taskAttr = '';
  44  $title    = '';
  45  $idAttr   = !empty($id)             ? ' id="' . $id . '"' : '';
  46  $listAttr = !empty($listCheck)      ? ' list-selection' : '';
  47  $formAttr = !empty($form)           ? ' form="' . $this->escape($form) . '"' : '';
  48  $validate = !empty($formValidation) ? ' form-validation' : '';
  49  $msgAttr  = !empty($message)        ? ' confirm-message="' . $this->escape($message) . '"' : '';
  50  
  51  if ($id === 'toolbar-help') {
  52      $title = ' title="' . Text::_('JGLOBAL_OPENS_IN_A_NEW_WINDOW') . '"';
  53  }
  54  
  55  if (!empty($task)) {
  56      $taskAttr = ' task="' . $task . '"';
  57  } elseif (!empty($onclick)) {
  58      $htmlAttributes .= ' onclick="' . $onclick . '"';
  59  }
  60  
  61  $direction = Factory::getLanguage()->isRtl() ? 'dropdown-menu-end' : '';
  62  ?>
  63  <joomla-toolbar-button <?php echo $idAttr . $taskAttr . $listAttr . $formAttr . $validate . $msgAttr; ?>>
  64  <<?php echo $tagName; ?>
  65      class="<?php echo $btnClass ?? ''; ?>"
  66      <?php echo $htmlAttributes ?? ''; ?>
  67      <?php echo $title; ?>
  68      >
  69      <span class="<?php echo trim($class ?? ''); ?>" aria-hidden="true"></span>
  70      <?php echo $text ?? ''; ?>
  71  </<?php echo $tagName; ?>>
  72  <?php // If there is no toggle split then ensure the drop down items are rendered inside the custom element ?>
  73  <?php if (!($toggleSplit ?? true) && isset($dropdownItems) && trim($dropdownItems) !== '') : ?>
  74      <div class="dropdown-menu<?php echo ' ' . $direction; ?>">
  75          <?php echo $dropdownItems; ?>
  76      </div>
  77  <?php endif; ?>
  78  </joomla-toolbar-button>


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