summaryrefslogtreecommitdiff
path: root/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php
diff options
context:
space:
mode:
Diffstat (limited to 'fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php')
-rw-r--r--fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php36
1 files changed, 26 insertions, 10 deletions
diff --git a/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php b/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php
index 6063ba5..c70be2e 100644
--- a/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php
+++ b/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php
@@ -61,19 +61,14 @@ class BakeExtraHelper extends Helper
return $extraModels;
}
public function stringifySearchManagerConfig($filterConfig) {
- $field = array_key_exists('field', $filterConfig)?$filterConfig['field']:FALSE;
- unset($filterConfig['field']);
+ // Do not output Model & Template specific options here
unset($filterConfig['mode']);
unset($filterConfig['colspan']);
unset($filterConfig['hint']);
- $s = '';
- if ($field) {
- $s .= "\n 'field' => [";
- $s .= $this->Bake->stringifyList($field, ['indent'=>4]);
- $s .= "],";
- }
- $s .= $this->Bake->stringifyList($filterConfig, ['indent'=>3]);
- return $s;
+ //Bake::stringifyList() has bugs with nested array + option quotes in Cake 3.6.7
+ $s = var_export($filterConfig, true);
+ $s = str_replace([ 'array (', ')'], ['[', ']'], $s);
+ return trim($s, '[]') . ' ';
}
public function hasAction($action, $controllerName) {
@@ -103,4 +98,25 @@ class BakeExtraHelper extends Helper
return Hash::get($this->_config, "templateExtra.$controllerName.title");
}
+ public function hasOrderOpts($controllerName) {
+ if ( ! is_string($controllerName) ) return FALSE;
+ $orderOpts = $this->getOrderOpts($controllerName);
+ return (is_array($orderOpts) && count($orderOpts) > 0);
+ }
+
+ public function getOrderOpts($controllerName) {
+ if ( ! is_string($controllerName) ) return FALSE;
+ return Hash::get($this->_config, "templateExtra.$controllerName.order");
+ }
+
+ public function hasOrderHooks($controllerName) {
+ if ( ! is_string($controllerName) ) return FALSE;
+ $orderHooks = $this->getOrderHooks($controllerName);
+ return (is_array($orderHooks) && count($orderHooks) > 0);
+ }
+
+ public function getOrderHooks($controllerName) {
+ if ( ! is_string($controllerName) ) return FALSE;
+ return Hash::get($this->_config, "templateExtra.$controllerName.orderHook");
+ }
}