diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-20 08:18:04 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-20 08:18:04 +0200 |
commit | 5e90ca7ab1cddf94e500397549b85c54aed570da (patch) | |
tree | 51f6f7ad26aa83b2485b6665be695e4c6fbf8cb5 | |
parent | b59164b0b7451905adcca244e6395281eb0633ca (diff) | |
download | chd_gestion-5e90ca7ab1cddf94e500397549b85c54aed570da.zip chd_gestion-5e90ca7ab1cddf94e500397549b85c54aed570da.tar.gz chd_gestion-5e90ca7ab1cddf94e500397549b85c54aed570da.tar.bz2 |
index: no 'id' column by default
-rw-r--r-- | app-from-scratch.sh | 7 | ||||
-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 |
3 files changed, 16 insertions, 1 deletions
diff --git a/app-from-scratch.sh b/app-from-scratch.sh index c84fa0a..0268887 100644 --- a/app-from-scratch.sh +++ b/app-from-scratch.sh @@ -316,3 +316,10 @@ git add src/Template/Layout/default.ctp webroot/css/local.css git add ../app-from-scratch.sh git commit -m "bake add Search filter support" +# b59164b0b7451905adcca244e6395281eb0633ca + +# index: no 'id' column by default +editor plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php plugins/CustomTheme/src/Template/Bake/Template/index.twig +git add plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php plugins/CustomTheme/src/Template/Bake/Template/index.twig +git add ../app-from-scratch.sh +git commit -m "index: no 'id' column by default" 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"); |