[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/layouts/joomla/form/ -> renderfield.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  Layout
   6   *
   7   * @copyright   (C) 2014 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);
  16  
  17  /**
  18   * Layout variables
  19   * -----------------
  20   * @var   array   $options      Optional parameters
  21   * @var   string  $id           The id of the input this label is for
  22   * @var   string  $name         The name of the input this label is for
  23   * @var   string  $label        The html code for the label
  24   * @var   string  $input        The input field html code
  25   * @var   string  $description  An optional description to use as in–line help text
  26   * @var   string  $descClass    The class name to use for the description
  27   */
  28  
  29  if (!empty($options['showonEnabled'])) {
  30      /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
  31      $wa = Factory::getApplication()->getDocument()->getWebAssetManager();
  32      $wa->useScript('showon');
  33  }
  34  
  35  $class           = empty($options['class']) ? '' : ' ' . $options['class'];
  36  $rel             = empty($options['rel']) ? '' : ' ' . $options['rel'];
  37  $id              = ($id ?? $name) . '-desc';
  38  $hideLabel       = !empty($options['hiddenLabel']);
  39  $hideDescription = empty($options['hiddenDescription']) ? false : $options['hiddenDescription'];
  40  $descClass       = ($options['descClass'] ?? '') ?: (!empty($options['inlineHelp']) ? 'hide-aware-inline-help d-none' : '');
  41  
  42  if (!empty($parentclass)) {
  43      $class .= ' ' . $parentclass;
  44  }
  45  
  46  ?>
  47  <div class="control-group<?php echo $class; ?>"<?php echo $rel; ?>>
  48      <?php if ($hideLabel) : ?>
  49          <div class="visually-hidden"><?php echo $label; ?></div>
  50      <?php else : ?>
  51          <div class="control-label"><?php echo $label; ?></div>
  52      <?php endif; ?>
  53      <div class="controls">
  54          <?php echo $input; ?>
  55          <?php if (!$hideDescription && !empty($description)) : ?>
  56              <div id="<?php echo $id; ?>" class="<?php echo $descClass ?>">
  57                  <small class="form-text">
  58                      <?php echo $description; ?>
  59                  </small>
  60              </div>
  61          <?php endif; ?>
  62      </div>
  63  </div>


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