2016-10-14 03:30:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\View\Tests\SSViewerTest;
|
|
|
|
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
use SilverStripe\View\TemplateGlobalProvider;
|
|
|
|
|
|
|
|
class TestGlobalProvider implements TemplateGlobalProvider, TestOnly
|
|
|
|
{
|
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public static function get_template_global_variables()
|
|
|
|
{
|
2020-04-20 19:58:09 +02:00
|
|
|
return [
|
|
|
|
'SSViewerTest_GlobalHTMLFragment' => ['method' => 'get_html', 'casting' => 'HTMLFragment'],
|
|
|
|
'SSViewerTest_GlobalHTMLEscaped' => ['method' => 'get_html'],
|
2016-12-16 05:34:21 +01:00
|
|
|
|
|
|
|
'SSViewerTest_GlobalAutomatic',
|
|
|
|
'SSViewerTest_GlobalReferencedByString' => 'get_reference',
|
2020-04-20 19:58:09 +02:00
|
|
|
'SSViewerTest_GlobalReferencedInArray' => ['method' => 'get_reference'],
|
2016-12-16 05:34:21 +01:00
|
|
|
|
2020-04-20 19:58:09 +02:00
|
|
|
'SSViewerTest_GlobalThatTakesArguments' => ['method' => 'get_argmix', 'casting' => 'HTMLFragment']
|
2016-12-16 05:34:21 +01:00
|
|
|
|
2020-04-20 19:58:09 +02:00
|
|
|
];
|
2016-12-16 05:34:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function get_html()
|
|
|
|
{
|
|
|
|
return '<div></div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function SSViewerTest_GlobalAutomatic()
|
|
|
|
{
|
|
|
|
return 'automatic';
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function get_reference()
|
|
|
|
{
|
|
|
|
return 'reference';
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function get_argmix()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
return 'z' . implode(':', $args) . 'z';
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
}
|