silverstripe-framework/view
Cam Spiers 14486902fb Allow users to extend the SSTemplateParser by defining open & closed blocks
Currently the only way the extend SSTemplateParser is to define a class
extension of it and then tell the injector component to use your new
custom class. This new change allows a user to define new "open blocks"
and "closed blocks" for SSTemplateParser to use without needing to
recompile the real SSTemplateParser class.

The following example shows how the functionality can be used
to add a new <% minify %>…<% end_minify %> syntax to the template parser

In a config.yml file, define the new minify closed block to call the
static function "Minifier::minify"

```
Injector:
	SSTemplateParser:
		properties:
			closedBlocks:
				minify: "Minifier::minify"
```

Define a new class with the minify static method that returns the new
template code when regenerating templates:

```
class Minifier {
    public static function minify(&$res) {
        return <<<PHP
{$res['Template']['php']}
\$val = zz\Html\HTMLMinify::minify(\$val, array('optimizationLevel' => zz\Html\HTMLMinify::OPTIMIZATION_ADVANCED));
PHP;
    }
}
```
2013-11-04 14:24:58 +13:00
..
ArrayData.php Add codesniffer that ensures indentation is with tabs. 2012-12-12 17:33:31 +13:00
GenericTemplateGlobalProvider.php FIX Remove instances of lines longer than 120c 2012-09-30 17:18:13 +13:00
Requirements.php API JS i18n files with short locale names, generated by build task 2013-10-25 12:05:46 +02:00
SSTemplateParser.php Allow users to extend the SSTemplateParser by defining open & closed blocks 2013-11-04 14:24:58 +13:00
SSTemplateParser.php.inc Allow users to extend the SSTemplateParser by defining open & closed blocks 2013-11-04 14:24:58 +13:00
SSViewer.php Feature to allow that changing the SSTemplateParser through the Injector system 2013-10-18 12:42:39 +13:00
TemplateGlobalProvider.php FIX Remove instances of lines longer than 120c 2012-09-30 17:18:13 +13:00
TemplateIteratorProvider.php Remove end php tag from TemplateIteratorProvider 2012-10-10 11:15:55 +13:00
TemplateParser.php Feature to allow that changing the SSTemplateParser through the Injector system 2013-10-18 12:42:39 +13:00
ViewableData.php FIX: ViewableData::obj() would sometimes return an empty object 2013-06-21 16:16:49 +00:00