From af6db51b7978aae874844e79e0103b0952d7b762 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Wed, 7 Oct 2020 14:05:17 +0800 Subject: [PATCH] Allow "no records" message to be defined for relation widgets. Both the "view" and "manage" widgets, in list mode, now support a custom message when no records are available. To maintain BC, if "emptyMessage" is provided in the relation config, this is still used for the "view" widget in list mode. Fixes https://github.com/octobercms/october/issues/3594 --- modules/backend/behaviors/RelationController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index 510242597..88ef54ff4 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -669,8 +669,9 @@ class RelationController extends ControllerBehavior $config->defaultSort = $this->getConfig('view[defaultSort]'); $config->recordsPerPage = $this->getConfig('view[recordsPerPage]'); $config->showCheckboxes = $this->getConfig('view[showCheckboxes]', !$this->readOnly); - $config->recordUrl = $this->getConfig('view[recordUrl]', null); - $config->customViewPath = $this->getConfig('view[customViewPath]', null); + $config->recordUrl = $this->getConfig('view[recordUrl]'); + $config->customViewPath = $this->getConfig('view[customViewPath]'); + $config->noRecordsMessage = $this->getConfig('view[noRecordsMessage]'); $defaultOnClick = sprintf( "$.oc.relationBehavior.clickViewListRecord(':%s', '%s', '%s')", @@ -818,6 +819,7 @@ class RelationController extends ControllerBehavior $config->showSorting = $this->getConfig('manage[showSorting]', !$isPivot); $config->defaultSort = $this->getConfig('manage[defaultSort]'); $config->recordsPerPage = $this->getConfig('manage[recordsPerPage]'); + $config->noRecordsMessage = $this->getConfig('manage[noRecordsMessage]'); if ($this->viewMode == 'single') { $config->showCheckboxes = false;