Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions modules/backend/behaviors/RelationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,7 @@ protected function makeToolbarWidget()
$useSearch = $this->viewMode === 'multi' && $this->getConfig('view[showSearch]');

if ($useSearch) {
$toolbarConfig->search = [
'prompt' => 'backend::lang.list.search_prompt'
];
$toolbarConfig->search = $this->getSearchConfig('view[search]');
}

/*
Expand All @@ -631,16 +629,29 @@ protected function makeToolbarWidget()
return $toolbarWidget;
}

protected function getSearchConfig($key)
{
$config = $this->getConfig($key);
$searchConfig = $this->makeConfig();

$searchConfig->prompt = array_get($config, 'prompt', 'backend::lang.list.search_prompt');
$searchConfig->mode = array_get($config, 'mode', 'all');
$searchConfig->scope = array_get($config, 'scope');
$searchConfig->searchOnEnter = array_get($config, 'searchOnEnter', false);

return $searchConfig;
}

protected function makeSearchWidget()
{
if (!$this->getConfig('manage[showSearch]')) {
return null;
}

$config = $this->makeConfig();
$config = $this->getSearchConfig('manage[search]');
$config->alias = $this->alias . 'ManageSearch';
$config->growable = false;
$config->prompt = 'backend::lang.list.search_prompt';

$widget = $this->makeWidget('Backend\Widgets\Search', $config);
$widget->cssClasses[] = 'recordfinder-search';

Expand Down Expand Up @@ -760,6 +771,11 @@ protected function makeViewWidget()
return $widget->onRefresh();
});

$widget->setSearchOptions([
'mode' => $searchWidget->mode,
'scope' => $searchWidget->scope,
]);

/*
* Persist the search term across AJAX requests only
*/
Expand Down Expand Up @@ -878,6 +894,11 @@ protected function makeManageWidget()
return $widget->onRefresh();
});

$widget->setSearchOptions([
'mode' => $this->searchWidget->mode,
'scope' => $this->searchWidget->scope,
]);

/*
* Persist the search term across AJAX requests only
*/
Expand Down
Loading