summaryrefslogtreecommitdiff
path: root/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2018-07-23 21:06:10 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2018-07-23 21:06:10 +0200
commit78043e3cccdf88981e79f14f3249c43a41211df7 (patch)
tree84a9528256608690dec9f06ec106b659f5b4578f /fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php
parent4e2624a23f056b985a7613fe6c648e9abb20e261 (diff)
downloadchd_gestion-78043e3cccdf88981e79f14f3249c43a41211df7.zip
chd_gestion-78043e3cccdf88981e79f14f3249c43a41211df7.tar.gz
chd_gestion-78043e3cccdf88981e79f14f3249c43a41211df7.tar.bz2
bake : action view/related items, limit to available actions.cake36
Bonus : don't display foreign key (if display here == view $id)
Diffstat (limited to 'fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php')
-rw-r--r--fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php11
1 files changed, 3 insertions, 8 deletions
diff --git a/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php b/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php
index a495973..d483d61 100644
--- a/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php
+++ b/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php
@@ -105,23 +105,18 @@ class BakeExtraHelper extends Helper
return $coll->take($takeFields)->toArray();
}
- public function filterFieldsOther($fields, $controllerName) {
-
+ public function filterFieldsOther($fields, $controllerName, $foreignKey) {
$takeFields = Hash::get($this->_config, "taskParams.$controllerName.index-columns");
if ( $takeFields === NULL )
$takeFields = Hash::get($this->_config, "taskParams.default.index-columns");
- //$filterTypes = ['binary']; // TODO
- $rejectFields = ['id'];
+ $rejectFields = ['id', $foreignKey ];
- $coll = collection($fields);
- $coll = $coll->reject(function ($field, $key) use ($rejectFields) {
+ $coll = collection($fields)->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");