[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/layouts/libraries/html/bootstrap/modal/ -> main.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  Layout
   6   *
   7   * @copyright   (C) 2015 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\Layout\LayoutHelper;
  14  use Joomla\Utilities\ArrayHelper;
  15  
  16  extract($displayData);
  17  
  18  /**
  19   * Layout variables
  20   * -----------------
  21   * @var   string  $selector  Unique DOM identifier for the modal. CSS id without #
  22   * @var   array   $params    Modal parameters. Default supported parameters:
  23   *                             - title        string   The modal title
  24   *                             - backdrop     mixed    A boolean select if a modal-backdrop element should be included (default = true)
  25   *                                                     The string 'static' includes a backdrop which doesn't close the modal on click.
  26   *                             - keyboard     boolean  Closes the modal when escape key is pressed (default = true)
  27   *                             - closeButton  boolean  Display modal close button (default = true)
  28   *                             - animation    boolean  Fade in from the top of the page (default = true)
  29   *                             - url          string   URL of a resource to be inserted as an <iframe> inside the modal body
  30   *                             - height       string   height of the <iframe> containing the remote resource
  31   *                             - width        string   width of the <iframe> containing the remote resource
  32   *                             - bodyHeight   int      Optional height of the modal body in viewport units (vh)
  33   *                             - modalWidth   int      Optional width of the modal in viewport units (vh)
  34   *                             - footer       string   Optional markup for the modal footer
  35   * @var   string  $body      Markup for the modal body. Appended after the <iframe> if the URL option is set
  36   */
  37  
  38  $modalClasses = array('modal');
  39  
  40  if (!isset($params['animation']) || $params['animation']) {
  41      $modalClasses[] = 'fade';
  42  }
  43  
  44  $modalWidth       = isset($params['modalWidth']) ? round((int) $params['modalWidth'], -1) : '';
  45  $modalDialogClass = '';
  46  
  47  if ($modalWidth && $modalWidth > 0 && $modalWidth <= 100) {
  48      $modalDialogClass = ' jviewport-width' . $modalWidth;
  49  }
  50  
  51  $modalAttributes = array(
  52      'tabindex' => '-1',
  53      'class'    => 'joomla-modal ' . implode(' ', $modalClasses)
  54  );
  55  
  56  if (isset($params['backdrop'])) {
  57      $modalAttributes['data-bs-backdrop'] = (is_bool($params['backdrop']) ? ($params['backdrop'] ? 'true' : 'false') : $params['backdrop']);
  58  }
  59  
  60  if (isset($params['keyboard'])) {
  61      $modalAttributes['data-bs-keyboard'] = (is_bool($params['keyboard']) ? ($params['keyboard'] ? 'true' : 'false') : 'true');
  62  }
  63  
  64  if (isset($params['url'])) {
  65      $url        = 'data-url="' . $params['url'] . '"';
  66      $iframeHtml = htmlspecialchars(LayoutHelper::render('libraries.html.bootstrap.modal.iframe', $displayData), ENT_COMPAT, 'UTF-8');
  67  }
  68  ?>
  69  <div id="<?php echo $selector; ?>" role="dialog" <?php echo ArrayHelper::toString($modalAttributes); ?> <?php echo $url ?? ''; ?> <?php echo isset($url) ? 'data-iframe="' . trim($iframeHtml) . '"' : ''; ?>>
  70      <div class="modal-dialog modal-lg<?php echo $modalDialogClass; ?>">
  71          <div class="modal-content">
  72              <?php
  73                  // Header
  74              if (!isset($params['closeButton']) || isset($params['title']) || $params['closeButton']) {
  75                  echo LayoutHelper::render('libraries.html.bootstrap.modal.header', $displayData);
  76              }
  77  
  78                  // Body
  79                  echo LayoutHelper::render('libraries.html.bootstrap.modal.body', $displayData);
  80  
  81                  // Footer
  82              if (isset($params['footer'])) {
  83                  echo LayoutHelper::render('libraries.html.bootstrap.modal.footer', $displayData);
  84              }
  85              ?>
  86          </div>
  87      </div>
  88  </div>


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