diff --git a/layouts/plugins/user/terms/label.php b/layouts/plugins/user/terms/label.php
new file mode 100644
index 0000000000000..2da6ad83fca9c
--- /dev/null
+++ b/layouts/plugins/user/terms/label.php
@@ -0,0 +1,103 @@
+ section in form XML.
+ * @var boolean $hidden Is this field hidden in the form?
+ * @var string $hint Placeholder for the field.
+ * @var string $id DOM id of the field.
+ * @var string $label Label of the field.
+ * @var string $labelclass Classes to apply to the label.
+ * @var boolean $multiple Does this field support multiple values?
+ * @var string $name Name of the input field.
+ * @var string $onchange Onchange attribute for the field.
+ * @var string $onclick Onclick attribute for the field.
+ * @var string $pattern Pattern (Reg Ex) of value of the form field.
+ * @var boolean $readonly Is this field read only?
+ * @var boolean $repeat Allows extensions to duplicate elements.
+ * @var boolean $required Is this field required?
+ * @var integer $size Size attribute of the input.
+ * @var boolean $spellcheck Spellcheck state for the form field.
+ * @var string $validate Validation rules to apply.
+ * @var string $value Value attribute of the field.
+ * @var array $options Options available for this field.
+ * @var array $termsnote The terms note that needs to be displayed
+ * @var array $translateLabel Should the label be translated?
+ * @var array $translateDescription Should the description be translated?
+ * @var array $translateHint Should the hint be translated?
+ * @var array $termsArticle The Article ID holding the Terms Article
+ * $var object $article The Article object
+ */
+
+// Get the label text from the XML element, defaulting to the element name.
+$text = $label ? (string) $label : (string) $name;
+$text = $translateLabel ? Text::_($text) : $text;
+
+// Set required to true as this field is not displayed at all if not required.
+$required = true;
+
+JHtml::_('behavior.modal');
+
+// Build the class for the label.
+$class = !empty($description) ? 'hasPopover' : '';
+$class = $class . ' required';
+$class = !empty($labelclass) ? $class . ' ' . $labelclass : $class;
+
+// Add the opening label tag and main attributes.
+$label = '';
+
+echo $label;
diff --git a/layouts/plugins/user/terms/message.php b/layouts/plugins/user/terms/message.php
new file mode 100644
index 0000000000000..60757d4bc4907
--- /dev/null
+++ b/layouts/plugins/user/terms/message.php
@@ -0,0 +1,48 @@
+ section in form XML.
+ * @var boolean $hidden Is this field hidden in the form?
+ * @var string $hint Placeholder for the field.
+ * @var string $id DOM id of the field.
+ * @var string $label Label of the field.
+ * @var string $labelclass Classes to apply to the label.
+ * @var boolean $multiple Does this field support multiple values?
+ * @var string $name Name of the input field.
+ * @var string $onchange Onchange attribute for the field.
+ * @var string $onclick Onclick attribute for the field.
+ * @var string $pattern Pattern (Reg Ex) of value of the form field.
+ * @var boolean $readonly Is this field read only?
+ * @var boolean $repeat Allows extensions to duplicate elements.
+ * @var boolean $required Is this field required?
+ * @var integer $size Size attribute of the input.
+ * @var boolean $spellcheck Spellcheck state for the form field.
+ * @var string $validate Validation rules to apply.
+ * @var string $value Value attribute of the field.
+ * @var array $options Options available for this field.
+ * @var array $termsnote The terms note that needs to be displayed
+ * @var array $translateLabel Should the label be translated?
+ * @var array $translateDescription Should the description be translated?
+ * @var array $translateHint Should the hint be translated?
+ * @var array $termsArticle The Article ID holding the Terms Article
+ */
+
+echo '
' . $termsnote . '
';
diff --git a/plugins/user/terms/field/terms.php b/plugins/user/terms/field/terms.php
index 5cdf1f0ed21ed..f1437459ad6ed 100644
--- a/plugins/user/terms/field/terms.php
+++ b/plugins/user/terms/field/terms.php
@@ -11,10 +11,8 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormHelper;
-use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Associations;
use Joomla\CMS\Language\Text;
-use Joomla\CMS\Router\Route;
FormHelper::loadFieldClass('radio');
@@ -42,9 +40,8 @@ class JFormFieldterms extends JFormFieldRadio
*/
protected function getInput()
{
- $termsnote = !empty($this->element['note']) ? $this->element['note'] : Text::_('PLG_USER_TERMS_NOTE_FIELD_DEFAULT');
-
- echo '
' . $termsnote . '
';
+ // Display the message before the field
+ echo $this->getRenderer('plugins.user.terms.message')->render($this->getLayoutData());
return parent::getInput();
}
@@ -63,49 +60,25 @@ protected function getLabel()
return '';
}
- // Get the label text from the XML element, defaulting to the element name.
- $text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name'];
- $text = $this->translateLabel ? Text::_($text) : $text;
-
- // Set required to true
- $this->required = true;
-
- JHtml::_('behavior.modal');
-
- // Build the class for the label.
- $class = !empty($this->description) ? 'hasPopover' : '';
- $class = $class . ' required';
- $class = !empty($this->labelClass) ? $class . ' ' . $this->labelClass : $class;
-
- // Add the opening label tag and main attributes.
- $label = '';
- return $label;
+ $extraData = array(
+ 'termsnote' => !empty($this->element['note']) ? $this->element['note'] : Text::_('PLG_USER_TERMS_NOTE_FIELD_DEFAULT'),
+ 'options' => $this->getOptions(),
+ 'value' => (string) $this->value,
+ 'translateLabel' => $this->translateLabel,
+ 'translateDescription' => $this->translateDescription,
+ 'translateHint' => $this->translateHint,
+ 'termsArticle' => $termsArticle,
+ 'article' => $article,
+ );
+
+ return array_merge($data, $extraData);
}
}