[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  Layout
   6   *
   7   * @copyright   (C) 2013 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  
  15  extract($displayData, EXTR_OVERWRITE);
  16  
  17  /**
  18   * Layout variables
  19   * -----------------
  20   * @var   string  $id
  21   * @var   string  $onclick
  22   * @var   string  $class
  23   * @var   string  $text
  24   * @var   string  $btnClass
  25   * @var   string  $tagName
  26   * @var   string  $htmlAttributes
  27   * @var   string  $task             The task which should be executed
  28   * @var   bool    $listCheck        Boolean, whether selection from a list is needed
  29   * @var   string  $form             CSS selector for a target form
  30   * @var   bool    $formValidation   Whether the form need to be validated before run the task
  31   * @var   string  $message          Confirmation message before run the task
  32   */
  33  
  34  Factory::getDocument()->getWebAssetManager()
  35      ->useScript('core')
  36      ->useScript('webcomponent.toolbar-button');
  37  
  38  $tagName  = $tagName ?? 'button';
  39  
  40  $taskAttr = '';
  41  $idAttr   = !empty($id)             ? ' id="' . $id . '"' : '';
  42  $listAttr = !empty($listCheck)      ? ' list-selection' : '';
  43  $formAttr = !empty($form)           ? ' form="' . $this->escape($form) . '"' : '';
  44  $validate = !empty($formValidation) ? ' form-validation' : '';
  45  $msgAttr  = !empty($message)        ? ' confirm-message="' . $this->escape($message) . '"' : '';
  46  
  47  if (!empty($task)) {
  48      $taskAttr = ' task="' . $task . '"';
  49  } elseif (!empty($onclick)) {
  50      $htmlAttributes .= ' onclick="' . $onclick . '"';
  51  }
  52  
  53  ?>
  54  
  55  <joomla-toolbar-button <?php echo $idAttr . $taskAttr . $listAttr . $formAttr . $validate . $msgAttr; ?>>
  56  <?php if (!empty($group)) : ?>
  57  <a href="#" class="dropdown-item">
  58      <span class="<?php echo trim($class ?? ''); ?>"></span>
  59      <?php echo $text ?? ''; ?>
  60  </a>
  61  <?php else : ?>
  62  <<?php echo $tagName; ?>
  63      class="<?php echo $btnClass ?? ''; ?>"
  64      <?php echo $htmlAttributes ?? ''; ?>
  65      >
  66      <span class="<?php echo trim($class ?? ''); ?>" aria-hidden="true"></span>
  67      <?php echo $text ?? ''; ?>
  68  </<?php echo $tagName; ?>>
  69  <?php endif; ?>
  70  </joomla-toolbar-button>


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