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, 8 insertions, 4 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 8938f6a..78183f6 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 @@ -13,6 +13,7 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT License */ #} +{% set compact = ["'#{pluralName}'"] %} /** * Index method @@ -34,10 +35,13 @@ {% else %} ${{ pluralName }} = $this->paginate($this->{{ currentModelName }}); {% endif %} - $this->set('{{ pluralName }}', ${{ pluralName }}); -{% for model in BakeExtra.getFiltersExtraModels(name, modelObj) %} - $this->loadModel('{{ model.getAlias }}'); - $this->set('{{ model.getAlias|variable }}', $this->{{ model.getAlias }}->find('list')->toArray()); +{% for model in BakeExtra.getFiltersExtraModels(name, modelObj) %} + {%- set otherName = model.getAlias %} + {%- set otherPlural = otherName|variable %} + ${{ otherPlural }} = $this->{{ currentModelName }}->{{ otherName }}->find('list'); + {{- "\n" }} + {%- set compact = compact|merge(["'#{otherPlural}'"]) %} {% endfor %} + $this->set(compact({{ compact|join(', ')|raw }})); } |