diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-20 00:41:45 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-20 00:41:45 +0200 |
commit | b59164b0b7451905adcca244e6395281eb0633ca (patch) | |
tree | 098111b525b796221a931aaae5c1688cf1a45d88 /fai_gestion/plugins/CustomTheme/config | |
parent | 76ab63096a25f5bf7b9d076cdc9ab3fc5218d216 (diff) | |
download | chd_gestion-b59164b0b7451905adcca244e6395281eb0633ca.zip chd_gestion-b59164b0b7451905adcca244e6395281eb0633ca.tar.gz chd_gestion-b59164b0b7451905adcca244e6395281eb0633ca.tar.bz2 |
bake add Search filter support
Diffstat (limited to 'fai_gestion/plugins/CustomTheme/config')
-rw-r--r-- | fai_gestion/plugins/CustomTheme/config/bootstrap.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fai_gestion/plugins/CustomTheme/config/bootstrap.php b/fai_gestion/plugins/CustomTheme/config/bootstrap.php index f90c873..7215ce7 100644 --- a/fai_gestion/plugins/CustomTheme/config/bootstrap.php +++ b/fai_gestion/plugins/CustomTheme/config/bootstrap.php @@ -38,8 +38,21 @@ EventManager::instance()->on('Bake.beforeRender.Controller.controller', function if ( is_array($actions) ) { $view->viewVars['actions'] = count($actions)?$actions:['_empty']; } + // Add Search.Prg component if we have configured filters in bake_extra.php + $controllerName = $view->viewVars['name']; + if ( $view->BakeExtra->hasFilters($controllerName) ) { + $view->viewVars['components'] += ['Search.Prg']; + } }); +EventManager::instance()->on('Bake.beforeRender.Model.table', function (Event $event) { + $view = $event->getSubject(); + // Add Search.Search behavior if we have configured filters in bake_extra.php + $controllerName = $view->viewVars['name']; + if ( $view->BakeExtra->hasFilters($controllerName) ) { + $view->viewVars['behaviors'] += ['Search.Search' => [] ]; + } +}); /* * Note : "cake bake all" behavior is customized in * plugins/CustomTheme/src/Shell/BakeShell.php |