diff options
Diffstat (limited to 'fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/index.twig')
-rw-r--r-- | fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/index.twig | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/index.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/index.twig index 181e830..8938f6a 100644 --- a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/index.twig +++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/index.twig @@ -27,7 +27,17 @@ 'contain' => [{{ Bake.stringifyList(belongsTo, {'indent': false})|raw }}] ]; {% endif %} +{%- if BakeExtra.hasFilters(name) %} + $query = $this->{{ currentModelName }} + ->find('search', ['search' => $this->request->getQueryParams()]); + ${{ pluralName }} = $this->paginate($query); +{% else %} ${{ pluralName }} = $this->paginate($this->{{ currentModelName }}); +{% endif %} + $this->set('{{ pluralName }}', ${{ pluralName }}); +{% for model in BakeExtra.getFiltersExtraModels(name, modelObj) %} - $this->set(compact('{{ pluralName }}')); + $this->loadModel('{{ model.getAlias }}'); + $this->set('{{ model.getAlias|variable }}', $this->{{ model.getAlias }}->find('list')->toArray()); +{% endfor %} } |