diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-22 19:55:25 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-22 19:55:25 +0200 |
commit | 32998439f320ad0b36f91b7e508f8039ee0caa95 (patch) | |
tree | 36d34f1a1385034ff7694a4a6f142d09b02055ba /fai_gestion/plugins | |
parent | 003871b6328d3a3f292aab16928f80e3258239ca (diff) | |
download | chd_gestion-32998439f320ad0b36f91b7e508f8039ee0caa95.zip chd_gestion-32998439f320ad0b36f91b7e508f8039ee0caa95.tar.gz chd_gestion-32998439f320ad0b36f91b7e508f8039ee0caa95.tar.bz2 |
Tidy identation for stringify replacement with var_export
Diffstat (limited to 'fai_gestion/plugins')
-rw-r--r-- | fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php b/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php index c70be2e..eb4b1df 100644 --- a/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php +++ b/fai_gestion/plugins/CustomTheme/src/View/Helper/BakeExtraHelper.php @@ -61,6 +61,8 @@ class BakeExtraHelper extends Helper return $extraModels; } public function stringifySearchManagerConfig($filterConfig) { + $indent = 2; + $tab = ' '; // Do not output Model & Template specific options here unset($filterConfig['mode']); unset($filterConfig['colspan']); @@ -68,7 +70,16 @@ class BakeExtraHelper extends Helper //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, '[]') . ' '; + $s = preg_replace_callback( + // for each text line, replace ' ' idents by $tab, adding a $indent offset + '/^([ ]+)/m', + function($ms) use ($indent, $tab) { + return str_repeat($tab, $indent+floor(strlen($ms[1])/2)); + }, + $s + ); + $s = trim($s, '[]'); + return $s . str_repeat($tab, $indent); } public function hasAction($action, $controllerName) { |