Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.1] Add Global Setting for Form Layout option to custom fields #37320

Merged
merged 77 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
5a7d86b
Rename option to more explicative name
AndySDH Mar 19, 2022
cd69098
Remove string from here, we need it for mulitple field types
AndySDH Mar 19, 2022
7ecaf31
Remove string from here, we need it for mulitple field types
AndySDH Mar 19, 2022
b198242
Implement global language strings for select types
AndySDH Mar 19, 2022
fd81516
Move setting to correct place, add global inherit
AndySDH Mar 19, 2022
0364134
Move setting to correct place, add global inherit
AndySDH Mar 19, 2022
266f792
Move setting to correct place, add global inherit
AndySDH Mar 19, 2022
008d415
We need to implement it for integer field as well
AndySDH Mar 19, 2022
7bee728
Implement global setting for integer
AndySDH Mar 19, 2022
4c07339
Implement global setting for list
AndySDH Mar 19, 2022
50c7f80
Implement global setting for sql
AndySDH Mar 19, 2022
91e9ef7
Implement global setting for radio
AndySDH Mar 19, 2022
0d9d043
Fix a minor bug, sql query should not be required
AndySDH Mar 19, 2022
9b404f3
This is now in the fieldparams instead of the params
AndySDH Mar 19, 2022
1a4184b
Support for Language Strings from com_fields
AndySDH Mar 19, 2022
e242069
Fixing code
AndySDH Mar 19, 2022
064a38b
Make phpcs happy
AndySDH Mar 19, 2022
df57312
Make phpcs happy
AndySDH Mar 19, 2022
9e65209
order the strings alphabetically
AndySDH Mar 19, 2022
3abd851
Update plugins/fields/integer/params/integer.xml
AndySDH Mar 19, 2022
daabbd6
Update plugins/fields/list/params/list.xml
AndySDH Mar 19, 2022
82febcd
Update plugins/fields/sql/params/sql.xml
AndySDH Mar 19, 2022
40e753d
Update plugins/fields/radio/params/radio.xml
AndySDH Mar 19, 2022
2766028
Add the needed language strings here so they can be shared
AndySDH Mar 19, 2022
90d09a7
Moved the language string to lib_joomla.ini
AndySDH Mar 19, 2022
64b5324
Reverting back, this is no longer needed
AndySDH Mar 19, 2022
8eccd89
Update language strings references
AndySDH Mar 19, 2022
e73ded1
Update language strings references
AndySDH Mar 19, 2022
b6a5e99
Update language strings references
AndySDH Mar 19, 2022
9137eee
Update language strings references
AndySDH Mar 19, 2022
a881dd4
Update language strings references
AndySDH Mar 19, 2022
33d85eb
Update language strings references
AndySDH Mar 19, 2022
7d306d4
Update language strings references
AndySDH Mar 19, 2022
fe5833e
Update language strings references
AndySDH Mar 19, 2022
a8eff27
Update language strings references
AndySDH Mar 19, 2022
ac507a2
missed one
AndySDH Mar 19, 2022
1ce3589
Merge branch '4.1-dev' into patch-21
AndySDH Mar 20, 2022
c06f389
Merge branch '4.1-dev' into patch-21
AndySDH Mar 23, 2022
f0384cd
Merge branch '4.2-dev' into patch-21
AndySDH Mar 23, 2022
3340631
Merge branch '4.2-dev' into patch-21
laoneo Mar 28, 2022
e56baa7
Revert bug fix because reasons
AndySDH Mar 28, 2022
f291425
Update lib_joomla.ini
AndySDH Mar 28, 2022
ecf03c8
Update lib_joomla.ini
AndySDH Mar 28, 2022
b392dad
revert language change
AndySDH Mar 29, 2022
c198dde
revert language change
AndySDH Mar 29, 2022
7b132e8
revert language change
AndySDH Mar 29, 2022
cc3187d
revert language change
AndySDH Mar 29, 2022
49f6312
revert language change
AndySDH Mar 29, 2022
6a452eb
revert language change
AndySDH Mar 29, 2022
26b20ad
Remove useglobal="true"
AndySDH Mar 31, 2022
964d604
Remove useglobal="true"
AndySDH Mar 31, 2022
d347910
Remove useglobal="true"
AndySDH Mar 31, 2022
372d86a
Remove useglobal="true"
AndySDH Mar 31, 2022
d4a4952
Merge branch '4.2-dev' into patch-21
AndySDH Apr 26, 2022
55e73d2
Merge branch '4.2-dev' into patch-21
AndySDH Apr 26, 2022
a97f083
Merge branch '4.2-dev' into patch-21
AndySDH Jun 10, 2022
5711048
Merge tag 'psr12anchor' into psr12/merge/37320
joomla-bot Jun 27, 2022
aa6154d
Phase 1 convert BRANCH to PSR-12
joomla-bot Jun 27, 2022
38cf013
Phase 2 convert BRANCH to PSR-12
joomla-bot Jun 27, 2022
16f9b1e
Merge tag 'psr12final' into psr12/merge/37320
joomla-bot Jun 27, 2022
eba6177
Merge branch '5.0-dev' into patch-21
richard67 Aug 26, 2023
021971d
Update radio.xml
AndySDH Sep 10, 2023
4c16312
Update sql.xml
AndySDH Sep 10, 2023
85b75e0
Update list.xml
AndySDH Sep 10, 2023
5f6f871
Update integer.xml
AndySDH Sep 10, 2023
fd0eeec
Update integer.xml
AndySDH Sep 10, 2023
6b5d883
Update list.xml
AndySDH Sep 10, 2023
c18f95a
Update radio.xml
AndySDH Sep 10, 2023
3a77db7
Update radio.xml
AndySDH Sep 10, 2023
5267590
Merge branch '5.0-dev' into patch-21
AndySDH Sep 10, 2023
e5c3f27
Merge branch '5.0-dev' into patch-21
AndySDH Sep 15, 2023
efd0a6b
Update administrator/components/com_fields/src/Plugin/FieldsPlugin.php
AndySDH Sep 19, 2023
66875b2
Merge branch '5.1-dev' into patch-21
richard67 Oct 3, 2023
273e2f4
Merge branch '5.1-dev' into patch-21
QuyTon Oct 8, 2023
3894a49
Merge branch '5.1-dev' into patch-21
LadySolveig Nov 1, 2023
67e9ab0
Merge branch '5.1-dev' into patch-21
QuyTon Nov 2, 2023
7807d5f
Merge branch '5.1-dev' into patch-21
Razzo1987 Nov 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions administrator/components/com_fields/src/Plugin/FieldsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,6 @@ public function onCustomFieldsPrepareDom($field, \DOMElement $parent, Form $form
$node->setAttribute('showon', $showon_attribute);
}

if ($layout = $field->params->get('form_layout')) {
$node->setAttribute('layout', $layout);
}

if ($field->default_value !== '') {
$defaultNode = $node->appendChild(new \DOMElement('default'));
$defaultNode->appendChild(new \DOMCdataSection($field->default_value));
Expand All @@ -282,6 +278,12 @@ public function onCustomFieldsPrepareDom($field, \DOMElement $parent, Form $form
$params = clone $this->params;
$params->merge($field->fieldparams);

$layout = $params->get('form_layout');
AndySDH marked this conversation as resolved.
Show resolved Hide resolved

if ($layout) {
$node->setAttribute('layout', $layout);
}

// Set the specific field parameters
foreach ($params->toArray() as $key => $param) {
if (is_array($param)) {
Expand Down
1 change: 0 additions & 1 deletion administrator/language/en-GB/com_fields.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ COM_FIELDS_FIELD_EDITABLE_IN_BOTH="Both"
COM_FIELDS_FIELD_EDITABLE_IN_LABEL="Editable In"
COM_FIELDS_FIELD_EDITABLE_IN_SITE="Site"
COM_FIELDS_FIELD_FORM_EDIT="Edit Field"
COM_FIELDS_FIELD_FORM_LAYOUT_LABEL="Layout"
COM_FIELDS_FIELD_FORM_NEW="New Field"
COM_FIELDS_FIELD_FORMOPTIONS_HEADING="Form Options"
COM_FIELDS_FIELD_GROUP_LABEL="Field Group"
Expand Down
3 changes: 3 additions & 0 deletions administrator/language/en-GB/lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ JLIB_FORM_FIELD_PARAM_INTEGER_LAST_DESC="This value is the highest in the list."
JLIB_FORM_FIELD_PARAM_INTEGER_LAST_LABEL="Last"
JLIB_FORM_FIELD_PARAM_INTEGER_STEP_DESC="Each option will be the previous option incremented by this integer, starting with the first value until the last value is reached."
JLIB_FORM_FIELD_PARAM_INTEGER_STEP_LABEL="Step"
JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT="HTML Select"
JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT="Enhanced Select"
JLIB_FORM_FIELD_PARAM_LAYOUT_LABEL="Form Layout"
JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_DESC="Allow multiple values to be selected."
JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_LABEL="Multiple"
JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_DESC="The options of the list."
Expand Down
1 change: 0 additions & 1 deletion administrator/language/en-GB/plg_fields_list.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

PLG_FIELDS_LIST="Fields - List"
PLG_FIELDS_LIST_LABEL="List (%s)"
PLG_FIELDS_LIST_PARAMS_FORM_LAYOUT_FANCY_SELECT="Enhanced select"
PLG_FIELDS_LIST_PARAMS_MULTIPLE_LABEL="Multiple"
PLG_FIELDS_LIST_PARAMS_OPTIONS_LABEL="List Values"
PLG_FIELDS_LIST_PARAMS_OPTIONS_NAME_LABEL="Text"
Expand Down
1 change: 0 additions & 1 deletion administrator/language/en-GB/plg_fields_sql.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
PLG_FIELDS_SQL="Fields - SQL"
PLG_FIELDS_SQL_CREATE_NOT_POSSIBLE="Only a Super User can create or edit an SQL field!"
PLG_FIELDS_SQL_LABEL="SQL (%s)"
PLG_FIELDS_SQL_PARAMS_FORM_LAYOUT_FANCY_SELECT="Enhanced select"
PLG_FIELDS_SQL_PARAMS_HEADER_DESC="Add a string with no value at the top of the dropdown list eg ' - Select Article - '."
PLG_FIELDS_SQL_PARAMS_HEADER_LABEL="Header"
PLG_FIELDS_SQL_PARAMS_MULTIPLE_LABEL="Multiple"
Expand Down
11 changes: 11 additions & 0 deletions plugins/fields/integer/integer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
<option value="1">JYES</option>
</field>

<field
name="form_layout"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_LABEL"
class="form-select"
default="joomla.form.field.list"
>
<option value="joomla.form.field.list">JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT</option>
<option value="joomla.form.field.list-fancy-select">JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT</option>
</field>

<field
name="first"
type="number"
Expand Down
16 changes: 16 additions & 0 deletions plugins/fields/integer/params/integer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,20 @@
/>
</fieldset>
</fields>
<fields name="params">
<fieldset name="basic">
<fieldset name="formoptions">
<field
name="form_layout"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_LABEL"
class="form-select"
>
<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
<option value="joomla.form.field.list">JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT</option>
<option value="joomla.form.field.list-fancy-select">JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT</option>
</field>
</fieldset>
</fieldset>
</fields>
</form>
11 changes: 11 additions & 0 deletions plugins/fields/list/list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
<option value="1">JYES</option>
</field>

<field
name="form_layout"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_LABEL"
class="form-select"
default="joomla.form.field.list"
>
<option value="joomla.form.field.list">JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT</option>
<option value="joomla.form.field.list-fancy-select">JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT</option>
</field>

<field
name="options"
type="subform"
Expand Down
7 changes: 4 additions & 3 deletions plugins/fields/list/params/list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@
<field
name="form_layout"
type="list"
label="COM_FIELDS_FIELD_FORM_LAYOUT_LABEL"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_LABEL"
class="form-select"
>
<option value="joomla.form.field.list">JDEFAULT</option>
<option value="joomla.form.field.list-fancy-select">PLG_FIELDS_LIST_PARAMS_FORM_LAYOUT_FANCY_SELECT</option>
<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
<option value="joomla.form.field.list">JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT</option>
<option value="joomla.form.field.list-fancy-select">JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT</option>
</field>
</fieldset>
</fieldset>
Expand Down
11 changes: 2 additions & 9 deletions plugins/fields/radio/params/radio.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,16 @@
</field>
</fieldset>
</fields>

<fields name="params">
<fieldset name="basic">
<field
name="class"
type="textarea"
label="COM_FIELDS_FIELD_CLASS_LABEL"
default="btn-group"
validate="CssIdentifier"
/>
<fieldset name="formoptions">
<field
name="form_layout"
type="list"
label="COM_FIELDS_FIELD_FORM_LAYOUT_LABEL"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_LABEL"
class="form-select"
>
<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
<option value="joomla.form.field.radio.buttons">PLG_FIELDS_RADIO_PARAMS_FORM_LAYOUT_BUTTONS</option>
<option value="joomla.form.field.radio.switcher">PLG_FIELDS_RADIO_PARAMS_FORM_LAYOUT_SWITCHER</option>
</field>
Expand Down
11 changes: 11 additions & 0 deletions plugins/fields/radio/radio.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@
<config>
<fields name="params">
<fieldset name="basic">
<field
name="form_layout"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_LABEL"
class="form-select"
default="joomla.form.field.radio.buttons"
>
<option value="joomla.form.field.radio.buttons">PLG_FIELDS_RADIO_PARAMS_FORM_LAYOUT_BUTTONS</option>
<option value="joomla.form.field.radio.switcher">PLG_FIELDS_RADIO_PARAMS_FORM_LAYOUT_SWITCHER</option>
</field>

<field
name="options"
type="subform"
Expand Down
7 changes: 4 additions & 3 deletions plugins/fields/sql/params/sql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@
<field
name="form_layout"
type="list"
label="COM_FIELDS_FIELD_FORM_LAYOUT_LABEL"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_LABEL"
class="form-select"
>
<option value="joomla.form.field.list">JDEFAULT</option>
<option value="joomla.form.field.list-fancy-select">PLG_FIELDS_SQL_PARAMS_FORM_LAYOUT_FANCY_SELECT</option>
<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
<option value="joomla.form.field.list">JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT</option>
<option value="joomla.form.field.list-fancy-select">JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT</option>
</field>
</fieldset>
</fieldset>
Expand Down
12 changes: 12 additions & 0 deletions plugins/fields/sql/sql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>

<field
name="form_layout"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_LABEL"
class="form-select"
default="joomla.form.field.list"
>
<option value="joomla.form.field.list">JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT</option>
<option value="joomla.form.field.list-fancy-select">JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT</option>
</field>

</fieldset>
</fields>
</config>
Expand Down