mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 02:16:41 +00:00
added support for {{ _self }} to provide an upgrade path from 1.x to 2.0
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
* 1.29.0 (2016-XX-XX)
|
||||
|
||||
* added support for {{ _self }} to provide an upgrade path from 1.x to 2.0 (replaces {{ _self.templateName }})
|
||||
* deprecated silent display of undefined blocks
|
||||
* deprecated support for mbstring.func_overload != 0
|
||||
|
||||
|
||||
+2
-1
@@ -181,7 +181,8 @@ Globals
|
||||
current ``Twig_Template`` instance is deprecated; most usages only need the
|
||||
current template name, which will continue to work in Twig 2.0. In Twig 2.0,
|
||||
``_self`` returns the current template name instead of the current
|
||||
``Twig_Template`` instance.
|
||||
``Twig_Template`` instance. If you are using ``{{ _self.templateName }}``,
|
||||
just replace it with ``{{ _self }}``.
|
||||
|
||||
Miscellaneous
|
||||
-------------
|
||||
|
||||
@@ -39,6 +39,14 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
$this->env = $env;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal this method will be removed in 2.0 and is only used internally to provide an upgrade path from 1.x to 2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getTemplateName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the template name.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
_self returns the template name
|
||||
--TEMPLATE--
|
||||
{{ _self }}
|
||||
--DATA--
|
||||
return array()
|
||||
--EXPECT--
|
||||
index.twig
|
||||
Reference in New Issue
Block a user