JoomlaPolska / jezyk-J4

Język polski dla Joomla 4
GNU General Public License v2.0
3 stars 5 forks source link

Conditional custom fields with showon #299

Closed joomlapl-bot closed 1 year ago

joomlapl-bot commented 1 year ago

PR w związku ze zmianą oryginału https://github.com/joomla/joomla-cms/pull/39051 Poniżej zmiany w oryginale:

Click to expand the diff! ```diff diff --git a/administrator/components/com_fields/forms/field.xml b/administrator/components/com_fields/forms/field.xml index 68becf152392..71ada60c9546 100644 --- a/administrator/components/com_fields/forms/field.xml +++ b/administrator/components/com_fields/forms/field.xml @@ -246,6 +246,13 @@ + +
diff --git a/administrator/components/com_fields/src/Plugin/FieldsPlugin.php b/administrator/components/com_fields/src/Plugin/FieldsPlugin.php index 51a4cde39013..d79cae71acfd 100644 --- a/administrator/components/com_fields/src/Plugin/FieldsPlugin.php +++ b/administrator/components/com_fields/src/Plugin/FieldsPlugin.php @@ -186,6 +186,11 @@ public function onCustomFieldsPrepareDom($field, \DOMElement $parent, Form $form $node->setAttribute('hint', $field->params->get('hint', '')); $node->setAttribute('required', $field->required ? 'true' : 'false'); + $showon_attribute = $field->params->get('showon', ''); + if ($showon_attribute) { + $node->setAttribute('showon', $showon_attribute); + } + if ($layout = $field->params->get('form_layout')) { $node->setAttribute('layout', $layout); } diff --git a/administrator/language/en-GB/com_fields.ini b/administrator/language/en-GB/com_fields.ini index d98ebb791da7..c77e8eecd3dd 100644 --- a/administrator/language/en-GB/com_fields.ini +++ b/administrator/language/en-GB/com_fields.ini @@ -59,6 +59,8 @@ COM_FIELDS_FIELD_REQUIRED_LABEL="Required" COM_FIELDS_FIELD_SAVE_SUCCESS="Field saved" COM_FIELDS_FIELD_SHOWLABEL_DESC="Show or Hide the label when the field displays." COM_FIELDS_FIELD_SHOWLABEL_LABEL="Label" +COM_FIELDS_FIELD_SHOWON_DESC="Conditionally show or hide the field depending on the value of other fields." +COM_FIELDS_FIELD_SHOWON_LABEL="Showon Attribute" COM_FIELDS_FIELD_SUFFIX_LABEL="Suffix" COM_FIELDS_FIELD_TYPE_LABEL="Type" COM_FIELDS_FIELD_USE_GLOBAL="Use settings from Plugin" ```