Source of file FluentTemplateGlobalProvider.php
Size: 0,979 Bytes - Last Modified: 2021-12-23T10:53:31+00:00
/var/www/docs.ssmods.com/process/src/src/View/FluentTemplateGlobalProvider.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344 | <?php namespace TractorCow\Fluent\View; use SilverStripe\View\TemplateGlobalProvider; use TractorCow\Fluent\Model\Locale; use TractorCow\Fluent\State\FluentState; class FluentTemplateGlobalProvider implements TemplateGlobalProvider { public static function get_template_global_variables() { return [ 'CurrentLocale' => [ 'method' => 'getCurrentLocale', 'casting' => 'Text', ], 'CurrentLocaleObject' => [ 'method' => 'getCurrentLocaleObject', ], ]; } /** * Returns the current locale * * @return string */ public static function getCurrentLocale() { return FluentState::singleton()->getLocale(); } /** * Returns the current locale object * * @return Locale|null */ public static function getCurrentLocaleObject(): ?Locale { return Locale::getCurrentLocale(); } } |