From 40a23e4f34cd2da1c806c191d20e156f5798779b Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Mon, 14 Aug 2023 12:57:39 -0600 Subject: [PATCH] Add "refresh" button to the RelationController --- modules/backend/behaviors/RelationController.php | 10 ++++++++++ .../relationcontroller/partials/_button_refresh.php | 6 ++++++ modules/backend/lang/en/lang.php | 1 + 3 files changed, 17 insertions(+) create mode 100644 modules/backend/behaviors/relationcontroller/partials/_button_refresh.php diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index fa6fb4c3da..cab3efda71 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -1025,6 +1025,12 @@ public function onRelationButtonLink() return $this->onRelationManageForm(); } + public function onRelationButtonRefresh() + { + $this->beforeAjax(); + return $this->relationRefresh(); + } + public function onRelationButtonUnlink() { return $this->onRelationManageRemove(); @@ -1588,6 +1594,10 @@ protected function evalToolbarButtons() $text = 'backend::lang.relation.add_name'; break; + case 'refresh': + $text = 'backend::lang.relation.refresh'; + break; + case 'remove': $text = 'backend::lang.relation.remove'; break; diff --git a/modules/backend/behaviors/relationcontroller/partials/_button_refresh.php b/modules/backend/behaviors/relationcontroller/partials/_button_refresh.php new file mode 100644 index 0000000000..993533fdb3 --- /dev/null +++ b/modules/backend/behaviors/relationcontroller/partials/_button_refresh.php @@ -0,0 +1,6 @@ + diff --git a/modules/backend/lang/en/lang.php b/modules/backend/lang/en/lang.php index a23509f1d1..6d57657dbf 100644 --- a/modules/backend/lang/en/lang.php +++ b/modules/backend/lang/en/lang.php @@ -327,6 +327,7 @@ 'relationwidget_unsupported_type' => 'The ":type" relation type is unsupported by the Relation widget.', 'help' => 'Click on an item to add', 'related_data' => 'Related :name data', + 'refresh' => 'Refresh', 'add' => 'Add', 'add_selected' => 'Add selected', 'add_a_new' => 'Add a new :name',