From 578f2dfa8e8015bcb5719272dead4fdf24199ea0 Mon Sep 17 00:00:00 2001 From: Benjamin Dalsass Date: Wed, 14 Jun 2023 14:50:17 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03190=20-=20Edit=20n:n=20LinkedSetIndirec?= =?UTF-8?q?t=20in=20object=20details=20using=20a=20tagset-like=20widget=20?= =?UTF-8?q?Add=20security=20if=20add=20option=20button=20js=20code=20isn't?= =?UTF-8?q?=20provided?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Application/UI/Base/Component/Input/Set/Set.php | 10 ++++++++++ .../base/components/input/set/layout.ready.js.twig | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/sources/Application/UI/Base/Component/Input/Set/Set.php b/sources/Application/UI/Base/Component/Input/Set/Set.php index d145db15c..804444986 100644 --- a/sources/Application/UI/Base/Component/Input/Set/Set.php +++ b/sources/Application/UI/Base/Component/Input/Set/Set.php @@ -205,6 +205,16 @@ class Set extends AbstractInput return $this; } + /** + * HasAddOptionButtonJsOnClick. + * + * @return bool + */ + public function HasAddOptionButtonJsOnClick(): bool + { + return $this->sAddOptionButtonJsOnClick != null; + } + /** * GetAddOptionButtonJsOnClick. * diff --git a/templates/base/components/input/set/layout.ready.js.twig b/templates/base/components/input/set/layout.ready.js.twig index dd19ed2b1..104c6aced 100644 --- a/templates/base/components/input/set/layout.ready.js.twig +++ b/templates/base/components/input/set/layout.ready.js.twig @@ -19,7 +19,7 @@ let oWidget{{ oUIBlock.GetId() }} = $('#{{ oUIBlock.GetId() }}').selectize({ plugins: { {# PLUGIN update operations #} 'combodo_update_operations' : { - initial: {{ oUIBlock.GetInitialValue()|raw }}, + initial: {{ oUIBlock.GetInitialValue()|raw }} }, {# PLUGIN combodo auto position #} 'combodo_auto_position' : { @@ -42,7 +42,7 @@ let oWidget{{ oUIBlock.GetId() }} = $('#{{ oUIBlock.GetId() }}').selectize({ tooltip_links_will_be_deleted_from_x_objects: '{{ 'UI:Links:Bulk:LinkWillBeDeletedFromXObjects'|dict_s }}', tooltip_links_exist_for_all_objects: '{{ 'UI:Links:Bulk:LinkExistForAllObjects'|dict_s }}', tooltip_links_exist_for_one_object: '{{ 'UI:Links:Bulk:LinkExistForOneObject'|dict_s }}', - tooltip_links_exist_for_x_objects: '{{ 'UI:Links:Bulk:LinkExistForXObjects'|dict_s }}', + tooltip_links_exist_for_x_objects: '{{ 'UI:Links:Bulk:LinkExistForXObjects'|dict_s }}' }, {% endif %} {# PLUGIN remove button #} @@ -200,7 +200,7 @@ let oWidget{{ oUIBlock.GetId() }} = $('#{{ oUIBlock.GetId() }}').selectize({ }, {# plugin combodo_add_button #} - {% if oUIBlock.HasAddOptionButton() %} + {% if oUIBlock.HasAddOptionButton() and oUIBlock.HasAddOptionButtonJsOnClick() %} onAdd: function(){ {{ oUIBlock.GetAddOptionButtonJsOnClick()|raw }}