diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-09-25 17:33:31 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2018-10-30 21:13:56 +0100 |
commit | 7f61dc95be4ac543986c7df2459532fd8f81368d (patch) | |
tree | 930497c659bbaa3e073313a261f3458348fd423d /src/Renderer | |
parent | 63d1292bf80d88be40eec7695c1a59f29e6609c5 (diff) |
EventConfig: Merge event configuration from database to global config
Diffstat (limited to 'src/Renderer')
-rw-r--r-- | src/Renderer/Twig/Extensions/Globals.php | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/src/Renderer/Twig/Extensions/Globals.php b/src/Renderer/Twig/Extensions/Globals.php index 1a4df42c..f9bffbc8 100644 --- a/src/Renderer/Twig/Extensions/Globals.php +++ b/src/Renderer/Twig/Extensions/Globals.php @@ -2,7 +2,6 @@ namespace Engelsystem\Renderer\Twig\Extensions; -use Carbon\Carbon; use Twig_Extension as TwigExtension; use Twig_Extension_GlobalsInterface as GlobalsInterface; @@ -17,45 +16,8 @@ class Globals extends TwigExtension implements GlobalsInterface { global $user; - $eventConfig = $this->getEventConfig(); - if (empty($eventConfig)) { - $eventConfig = []; - } - return [ - 'user' => isset($user) ? $user : [], - 'event_config' => $this->filterEventConfig($eventConfig), + 'user' => isset($user) ? $user : [], ]; } - - /** - * @return array - * @codeCoverageIgnore - */ - protected function getEventConfig() - { - return EventConfig(); - } - - /** - * @param $eventConfig - * @return mixed - */ - protected function filterEventConfig($eventConfig) - { - array_walk($eventConfig, function (&$value, $key) { - if (is_null($value) || !in_array($key, [ - 'buildup_start_date', - 'event_start_date', - 'event_end_date', - 'teardown_end_date', - ])) { - return; - } - - $value = Carbon::createFromTimestamp($value); - }); - - return $eventConfig; - } } |