[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/layouts/joomla/editors/buttons/ -> modal.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  Layout
   6   *
   7   * @copyright   (C) 2016 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\HTML\HTMLHelper;
  14  use Joomla\CMS\Language\Text;
  15  use Joomla\CMS\Uri\Uri;
  16  
  17  $button = $displayData;
  18  
  19  if (!$button->get('modal')) {
  20      return;
  21  }
  22  
  23  $class    = ($button->get('class')) ? $button->get('class') : null;
  24  $class   .= ($button->get('modal')) ? ' modal-button' : null;
  25  $href     = '#' . strtolower($button->get('name')) . '_modal';
  26  $link     = ($button->get('link')) ? Uri::base() . $button->get('link') : null;
  27  $onclick  = ($button->get('onclick')) ? ' onclick="' . $button->get('onclick') . '"' : '';
  28  $title    = ($button->get('title')) ? $button->get('title') : $button->get('text');
  29  $options  = is_array($button->get('options')) ? $button->get('options') : array();
  30  
  31  $confirm = '';
  32  
  33  if (is_array($button->get('options')) && isset($options['confirmText']) && isset($options['confirmCallback'])) {
  34      $confirm = '<button type="button" class="btn btn-success" data-bs-dismiss="modal" onclick="' . $options['confirmCallback'] . '">'
  35          . $options['confirmText'] . ' </button>';
  36  }
  37  
  38  if (null !== $button->get('id')) {
  39      $id = str_replace(' ', '', $button->get('id'));
  40  } else {
  41      $id = strtolower($button->get('name')) . '_modal';
  42  }
  43  
  44  // @todo: J4: Move Make buttons fullscreen on smaller devices per https://github.com/joomla/joomla-cms/pull/23091
  45  // Create the modal
  46  echo HTMLHelper::_(
  47      'bootstrap.renderModal',
  48      $id,
  49      array(
  50          'url'    => $link,
  51          'title'  => $title,
  52          'height' => array_key_exists('height', $options) ? $options['height'] : '400px',
  53          'width'  => array_key_exists('width', $options) ? $options['width'] : '800px',
  54          'bodyHeight'  => array_key_exists('bodyHeight', $options) ? $options['bodyHeight'] : '70',
  55          'modalWidth'  => array_key_exists('modalWidth', $options) ? $options['modalWidth'] : '80',
  56          'footer' => $confirm . '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">'
  57              . Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
  58      )
  59  );


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