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
This commit is contained in:
Ben Thomson 2020-10-07 14:05:17 +08:00
parent f8f5e6e022
commit af6db51b79
No known key found for this signature in database
GPG Key ID: 8BDB18DD0909BE22
1 changed files with 4 additions and 2 deletions

View File

@ -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;