diff options
Diffstat (limited to 'fai_gestion/plugins/CustomTheme')
-rw-r--r-- | fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig | 2 | ||||
-rw-r--r-- | fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig index 15bfe45..7950242 100644 --- a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig +++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig @@ -43,7 +43,7 @@ // index could contain table head filters and labels in <th> aren't useful $this->Form->setTemplates(['label' => '']); ?> -{% set fields = Bake.filterFields(fields, schema, modelObject, indexColumns, ['binary', 'text']) %} +{% set fields = BakeExtra.filterFields(fields, schema, modelObject, indexColumns, ['binary', 'text']) %} <nav class="large-3 medium-4 columns" id="actions-sidebar"> <ul class="side-nav"> <li class="heading"><?= __('Actions') ?></li> diff --git a/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php b/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php index f58de2a..6063ba5 100644 --- a/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php +++ b/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php @@ -90,6 +90,14 @@ class BakeExtraHelper extends Helper return $actions; } + public function filterFields($fields, $schema, $modelObject = null, $takeFields = [], $filterTypes = ['binary'], $rejectFields = ['id']) { + $coll = collection($this->Bake->filterFields($fields, $schema, $modelObject, [], $filterTypes)); + $coll = $coll->reject(function ($field, $key) use ($rejectFields) { + return in_array($field, $rejectFields); + }); + + return $coll->take($takeFields)->toArray(); + } public function getTitleOpts($controllerName) { if ( ! is_string($controllerName) ) return FALSE; return Hash::get($this->_config, "templateExtra.$controllerName.title"); |