[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/layouts/plugins/user/terms/ -> label.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  User.terms
   6   *
   7   * @copyright   (C) 2019 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\Router\Route;
  16  
  17  extract($displayData);
  18  
  19  /**
  20   * Layout variables
  21   * -----------------
  22   * @var   string   $autocomplete           Autocomplete attribute for the field.
  23   * @var   boolean  $autofocus              Is autofocus enabled?
  24   * @var   string   $class                  Classes for the input.
  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    $options                Options available for this field.
  45   * @var   array    $termsnote              The terms note that needs to be displayed
  46   * @var   array    $translateLabel         Should the label be translated?
  47   * @var   array    $translateHint          Should the hint be translated?
  48   * @var   array    $termsArticle           The Article ID holding the Terms Article
  49   * @var   object   $article                The Article object
  50   */
  51  
  52  // Get the label text from the XML element, defaulting to the element name.
  53  $text = $label ? (string) $label : (string) $name;
  54  $text = $translateLabel ? Text::_($text) : $text;
  55  
  56  // Set required to true as this field is not displayed at all if not required.
  57  $required = true;
  58  
  59  // Build the class for the label.
  60  $class = 'required';
  61  $class = !empty($labelclass) ? $class . ' ' . $labelclass : $class;
  62  
  63  if ($article) {
  64      $attribs = [
  65          'data-bs-toggle' => 'modal',
  66          'data-bs-target' => '#tosModal',
  67          'class' => 'required',
  68      ];
  69  
  70      $link = HTMLHelper::_('link', Route::_($article->link . '&tmpl=component'), $text, $attribs);
  71  
  72      echo HTMLHelper::_(
  73          'bootstrap.renderModal',
  74          'tosModal',
  75          [
  76              'url'    => Route::_($article->link . '&tmpl=component'),
  77              'title'  => $text,
  78              'height' => '100%',
  79              'width'  => '100%',
  80              'bodyHeight'  => 70,
  81              'modalWidth'  => 80,
  82              'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-hidden="true">'
  83                  . Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>',
  84          ]
  85      );
  86  } else {
  87      $link = '<span class="' . $class . '">' . $text . '</span>';
  88  }
  89  
  90  // Add the label text and star.
  91  $label = $link . '<span class="star" aria-hidden="true">&#160;*</span>';
  92  
  93  echo $label;


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