Skip to content

Commit aff6053

Browse files
committed
Disable entirely search view when no available search types
1 parent 9b5fae7 commit aff6053

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

config/areas/search/views.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
<?php
22

33
use Kirby\Cms\App;
4+
use Kirby\Panel\Panel;
5+
use Kirby\Panel\View;
46

57
return [
68
'search' => [
79
'pattern' => 'search',
10+
'when' => function (): bool {
11+
// checks core and custom search areas
12+
$permissions = App::instance()->user()?->role()->permissions()->toArray() ?? [];
13+
$searches = View::searches(Panel::areas(), $permissions);
14+
15+
return empty($searches) === false;
16+
},
817
'action' => function () {
918
return [
1019
'component' => 'k-search-view',

0 commit comments

Comments
 (0)