-
+
diff --git a/libraries/src/Form/Field/NoteField.php b/libraries/src/Form/Field/NoteField.php
index a975ab949a55e..4cb1fea8d8060 100644
--- a/libraries/src/Form/Field/NoteField.php
+++ b/libraries/src/Form/Field/NoteField.php
@@ -30,6 +30,22 @@ class NoteField extends FormField
*/
protected $type = 'Note';
+ /**
+ * Hide the label when rendering the form field.
+ *
+ * @var boolean
+ * @since 4.0.0
+ */
+ protected $hiddenLabel = true;
+
+ /**
+ * Hide the description when rendering the form field.
+ *
+ * @var boolean
+ * @since 4.0.0
+ */
+ protected $hiddenDescription = true;
+
/**
* Method to get the field label markup.
*
diff --git a/libraries/src/Form/FormField.php b/libraries/src/Form/FormField.php
index 12445af3585fd..efe9332adfd44 100644
--- a/libraries/src/Form/FormField.php
+++ b/libraries/src/Form/FormField.php
@@ -110,6 +110,15 @@ abstract class FormField
*/
protected $hiddenLabel = false;
+ /**
+ * Should the description be hidden when rendering the form field? This may be useful if you have the
+ * description rendering in your form field itself for e.g. note fields.
+ *
+ * @var boolean
+ * @since 4.0.0
+ */
+ protected $hiddenDescription = false;
+
/**
* True to translate the field label string.
*
@@ -1027,9 +1036,28 @@ public function renderField($options = array())
$options['rel'] = '';
- if (empty($options['hiddenLabel']) && $this->getAttribute('hiddenLabel') || $this->hiddenLabel)
+ if (empty($options['hiddenLabel']))
{
- $options['hiddenLabel'] = true;
+ if ($this->getAttribute('hiddenLabel'))
+ {
+ $options['hiddenLabel'] = $this->getAttribute('hiddenLabel') == 'true' ? true : false;
+ }
+ else
+ {
+ $options['hiddenLabel'] = $this->hiddenLabel;
+ }
+ }
+
+ if (empty($options['hiddenDescription']))
+ {
+ if ($this->getAttribute('hiddenDescription'))
+ {
+ $options['hiddenDescription'] = $this->getAttribute('hiddenDescription') == 'true' ? true : false;
+ }
+ else
+ {
+ $options['hiddenDescription'] = $this->hiddenDescription;
+ }
}
if ($this->showon)