[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/layouts/plugins/system/privacyconsent/ -> label.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  System.privacyconsent
   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    $privacynote            The privacy 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    $privacyArticle         The Article ID holding the Privacy Article.
  49   * @var   object   $article                The Article object.
  50   * @var   object   $privacyLink            Link to the privacy article or menu item.
  51   */
  52  
  53  // Get the label text from the XML element, defaulting to the element name.
  54  $text = $label ? (string) $label : (string) $name;
  55  $text = $translateLabel ? Text::_($text) : $text;
  56  
  57  // Set required to true as this field is not displayed at all if not required.
  58  $required = true;
  59  
  60  // Build the class for the label.
  61  $class = 'required';
  62  $class = !empty($labelclass) ? $class . ' ' . $labelclass : $class;
  63  
  64  if ($privacyLink) {
  65      $attribs = [
  66          'data-bs-toggle' => 'modal',
  67          'data-bs-target' => '#consentModal',
  68          'class' => 'required',
  69      ];
  70  
  71      $link = HTMLHelper::_('link', Route::_($privacyLink . '&tmpl=component'), $text, $attribs);
  72  
  73      echo HTMLHelper::_(
  74          'bootstrap.renderModal',
  75          'consentModal',
  76          [
  77              'url'    => Route::_($privacyLink . '&tmpl=component'),
  78              'title'  => $text,
  79              'height' => '100%',
  80              'width'  => '100%',
  81              'bodyHeight'  => 70,
  82              'modalWidth'  => 80,
  83              'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-hidden="true">'
  84                  . Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>',
  85          ]
  86      );
  87  } else {
  88      $link = '<span class="' . $class . '">' . $text . '</span>';
  89  }
  90  
  91  // Add the label text and star.
  92  $label = $link . '<span class="star" aria-hidden="true">&#160;*</span>';
  93  
  94  echo $label;


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