';
$opentab = 2;
}
diff --git a/layouts/joomla/form/renderfield.php b/layouts/joomla/form/renderfield.php
index 8b967b29bc501..dc60adafa73d4 100644
--- a/layouts/joomla/form/renderfield.php
+++ b/layouts/joomla/form/renderfield.php
@@ -21,6 +21,7 @@
* @var string $label The html code for the label
* @var string $input The input field html code
* @var string $description An optional description to use in a tooltip
+ * @var string $fieldWidth A hint for the field width
*/
if (!empty($options['showonEnabled']))
@@ -35,6 +36,10 @@
$id = $name . '-desc';
$hide = empty($options['hiddenLabel']) ? '' : ' sr-only';
$hideDescription = empty($options['hiddenDescription']) ? false : $options['hiddenDescription'];
+$fieldWidth = empty($fieldWidth) ? 'full' : $fieldWidth;
+
+$class .= ' ' . $fieldWidth;
+
?>
>
diff --git a/libraries/src/Form/Field/CalendarField.php b/libraries/src/Form/Field/CalendarField.php
index 782878cb9ac82..a078882fe1e6d 100644
--- a/libraries/src/Form/Field/CalendarField.php
+++ b/libraries/src/Form/Field/CalendarField.php
@@ -81,6 +81,18 @@ class CalendarField extends FormField
*/
protected $layout = 'joomla.form.field.calendar';
+ /**
+ * Hint for render width
+ * Possible values are:
+ * - full
+ * - large
+ * - medium
+ * - small
+ *
+ * @var string
+ */
+ protected $fieldWidth = 'small';
+
/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
diff --git a/libraries/src/Form/Field/EditorField.php b/libraries/src/Form/Field/EditorField.php
index 63e06575c15cf..ea2e64233beac 100644
--- a/libraries/src/Form/Field/EditorField.php
+++ b/libraries/src/Form/Field/EditorField.php
@@ -101,6 +101,18 @@ class EditorField extends TextareaField
*/
protected $editorType;
+ /**
+ * Hint for render width
+ * Possible values are:
+ * - full
+ * - large
+ * - medium
+ * - small
+ *
+ * @var string
+ */
+ protected $fieldWidth = 'full';
+
/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
diff --git a/libraries/src/Form/Field/MediaField.php b/libraries/src/Form/Field/MediaField.php
index 34bb06ddfb48b..cad0b74b43277 100644
--- a/libraries/src/Form/Field/MediaField.php
+++ b/libraries/src/Form/Field/MediaField.php
@@ -109,6 +109,18 @@ class MediaField extends FormField
*/
protected $layout = 'joomla.form.field.media';
+ /**
+ * Hint for render width
+ * Possible values are:
+ * - full
+ * - large
+ * - medium
+ * - small
+ *
+ * @var string
+ */
+ protected $fieldWidth = 'large';
+
/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
diff --git a/libraries/src/Form/Field/NumberField.php b/libraries/src/Form/Field/NumberField.php
index 2c3b0454733d9..9fd145fd974ba 100644
--- a/libraries/src/Form/Field/NumberField.php
+++ b/libraries/src/Form/Field/NumberField.php
@@ -65,6 +65,18 @@ class NumberField extends FormField
*/
protected $layout = 'joomla.form.field.number';
+ /**
+ * Hint for render width
+ * Possible values are:
+ * - full
+ * - large
+ * - medium
+ * - small
+ *
+ * @var string
+ */
+ protected $fieldWidth = 'small';
+
/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
diff --git a/libraries/src/Form/Field/RulesField.php b/libraries/src/Form/Field/RulesField.php
index 538cdf4aa4f31..450041941dfd9 100644
--- a/libraries/src/Form/Field/RulesField.php
+++ b/libraries/src/Form/Field/RulesField.php
@@ -65,6 +65,18 @@ class RulesField extends FormField
*/
protected $assetField;
+ /**
+ * Hint for render width
+ * Possible values are:
+ * - full
+ * - large
+ * - medium
+ * - small
+ *
+ * @var string
+ */
+ protected $fieldWidth = 'full';
+
/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
diff --git a/libraries/src/Form/FormField.php b/libraries/src/Form/FormField.php
index f1d4b76d7ec72..7a424c0b61e5a 100644
--- a/libraries/src/Form/FormField.php
+++ b/libraries/src/Form/FormField.php
@@ -369,6 +369,18 @@ abstract class FormField
*/
protected $renderLabelLayout = 'joomla.form.renderlabel';
+ /**
+ * Hint for render width
+ * Possible values are:
+ * - full
+ * - large
+ * - medium
+ * - small
+ *
+ * @var string
+ */
+ protected $fieldWidth = 'medium';
+
/**
* The data-attribute name and values of the form field.
* For example, data-action-type="click" data-action-type="change"
@@ -450,6 +462,7 @@ public function __get($name)
case 'spellcheck':
case 'validationtext':
case 'showon':
+ case 'fieldWidth':
return $this->$name;
case 'input':
@@ -514,6 +527,7 @@ public function __set($name, $value)
case 'validationtext':
case 'group':
case 'showon':
+ case 'fieldWidth':
case 'default':
$this->$name = (string) $value;
break;
@@ -639,10 +653,10 @@ public function setup(\SimpleXMLElement $element, $value, $group = null)
// Set the group of the field.
$this->group = $group;
- $attributes = array(
+ $attributes = [
'multiple', 'name', 'id', 'hint', 'class', 'description', 'labelclass', 'onchange', 'onclick', 'validate', 'pattern', 'validationtext',
'default', 'required', 'disabled', 'readonly', 'autofocus', 'hidden', 'autocomplete', 'spellcheck', 'translateHint', 'translateLabel',
- 'translate_label', 'translateDescription', 'translate_description', 'size', 'showon');
+ 'translate_label', 'translateDescription', 'translate_description', 'size', 'showon'];
$this->default = isset($element['value']) ? (string) $element['value'] : $this->default;
@@ -680,6 +694,8 @@ public function setup(\SimpleXMLElement $element, $value, $group = null)
$this->layout = !empty($this->element['layout']) ? (string) $this->element['layout'] : $this->layout;
+ $this->fieldWidth = isset($this->element['fieldWidth']) ? (string) $this->element['fieldWidth'] : $this->fieldWidth;
+
// Add required to class list if field is required.
if ($this->required)
{
@@ -1327,6 +1343,7 @@ protected function getLayoutData()
'value' => $this->value,
'dataAttribute' => $this->renderDataAttributes(),
'dataAttributes' => $this->dataAttributes,
+ 'fieldWidth' => $this->fieldWidth,
];
}