[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/layouts/joomla/form/field/ -> textarea.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\Factory;
  14  use Joomla\CMS\Language\Text;
  15  
  16  extract($displayData);
  17  
  18  /**
  19   * Layout variables
  20   * -----------------
  21   * @var   string   $autocomplete    Autocomplete attribute for the field.
  22   * @var   boolean  $autofocus       Is autofocus enabled?
  23   * @var   string   $class           Classes for the input.
  24   * @var   string   $description     Description of the field.
  25   * @var   boolean  $disabled        Is this field disabled?
  26   * @var   string   $group           Group the field belongs to. <fields> section in form XML.
  27   * @var   boolean  $hidden          Is this field hidden in the form?
  28   * @var   string   $hint            Placeholder for the field.
  29   * @var   string   $id              DOM id of the field.
  30   * @var   string   $label           Label of the field.
  31   * @var   string   $labelclass      Classes to apply to the label.
  32   * @var   boolean  $multiple        Does this field support multiple values?
  33   * @var   string   $name            Name of the input field.
  34   * @var   string   $onchange        Onchange attribute for the field.
  35   * @var   string   $onclick         Onclick attribute for the field.
  36   * @var   string   $pattern         Pattern (Reg Ex) of value of the form field.
  37   * @var   boolean  $readonly        Is this field read only?
  38   * @var   boolean  $repeat          Allows extensions to duplicate elements.
  39   * @var   boolean  $required        Is this field required?
  40   * @var   integer  $size            Size attribute of the input.
  41   * @var   boolean  $spellcheck      Spellcheck state for the form field.
  42   * @var   string   $validate        Validation rules to apply.
  43   * @var   string   $value           Value attribute of the field.
  44   * @var   array    $checkedOptions  Options that will be set as checked.
  45   * @var   boolean  $hasValue        Has this field a value assigned?
  46   * @var   array    $options         Options available for this field.
  47   * @var   array    $inputType       Options available for this field.
  48   * @var   string   $accept          File types that are accepted.
  49   * @var   boolean  $charcounter     Does this field support a character counter?
  50   * @var   string   $dataAttribute   Miscellaneous data attributes preprocessed for HTML output
  51   * @var   array    $dataAttributes  Miscellaneous data attribute for eg, data-*.
  52   */
  53  
  54  // Initialize some field attributes.
  55  if ($charcounter) {
  56      // Load the js file
  57      /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
  58      $wa = Factory::getApplication()->getDocument()->getWebAssetManager();
  59      $wa->useScript('short-and-sweet');
  60  
  61      // Set the css class to be used as the trigger
  62      $charcounter = ' charcount';
  63      // Set the text
  64      $counterlabel = 'data-counter-label="' . $this->escape(Text::_('JFIELD_META_DESCRIPTION_COUNTER')) . '"';
  65  }
  66  
  67  $attributes = array(
  68      $columns ?: '',
  69      $rows ?: '',
  70      !empty($class) ? 'class="form-control ' . $class . $charcounter . '"' : 'class="form-control' . $charcounter . '"',
  71      !empty($description) ? 'aria-describedby="' . ($id ?: $name) . '-desc"' : '',
  72      strlen($hint) ? 'placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
  73      $disabled ? 'disabled' : '',
  74      $readonly ? 'readonly' : '',
  75      $onchange ? 'onchange="' . $onchange . '"' : '',
  76      $onclick ? 'onclick="' . $onclick . '"' : '',
  77      $required ? 'required' : '',
  78      !empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
  79      $autofocus ? 'autofocus' : '',
  80      $spellcheck ? '' : 'spellcheck="false"',
  81      $maxlength ?: '',
  82      !empty($counterlabel) ? $counterlabel : '',
  83      $dataAttribute,
  84  );
  85  ?>
  86  <textarea name="<?php
  87  echo $name; ?>" id="<?php
  88  echo $id; ?>" <?php
  89  echo implode(' ', $attributes); ?> ><?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?></textarea>


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