commit b0646d06f069ec4401b7267780dd76dac8bcd2e6 Author: jrcallicott Date: Sun Jul 14 11:34:04 2013 -0400 #99 diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php index b54e49b..579e326 100644 --- a/core/lib/Drupal/Core/Template/TwigExtension.php +++ b/core/lib/Drupal/Core/Template/TwigExtension.php @@ -32,12 +32,9 @@ public function getFunctions() { public function getFilters() { return array( 't' => new \Twig_Filter_Function('t'), - /** - * Fake filters equivalent to "raw" and only used in the trans tag. - * - * These filters are necessary to identify the type of prefix to use - * when passing tokens to t() from a trans tag. - */ + // Fake filters equivalent to "raw" and only used in the trans tag. + // These filters are necessary to identify the type of prefix to use + // when passing tokens to t() from a trans tag. 'passthrough' => new \Twig_SimpleFilter('passthrough', 'twig_raw_filter'), 'placeholder' => new \Twig_SimpleFilter('placeholder', 'twig_raw_filter'), ); diff --git a/core/lib/Drupal/Core/Template/TwigNodeTrans.php b/core/lib/Drupal/Core/Template/TwigNodeTrans.php index c49be83..2f928a4 100644 --- a/core/lib/Drupal/Core/Template/TwigNodeTrans.php +++ b/core/lib/Drupal/Core/Template/TwigNodeTrans.php @@ -14,6 +14,10 @@ * system for internationalization. */ class TwigNodeTrans extends \Twig_Node { + + /** + * {@inheritdoc} + */ public function __construct(\Twig_NodeInterface $body, \Twig_NodeInterface $plural = NULL, \Twig_Node_Expression $count = NULL, $lineno, $tag = NULL) { parent::__construct(array( 'count' => $count, @@ -119,6 +123,9 @@ public function compile(\Twig_Compiler $compiler) { } } + /** + * {@inheritdoc} + */ protected function compileString(\Twig_NodeInterface $body) { if ($body instanceof \Twig_Node_Expression_Name || $body instanceof \Twig_Node_Expression_Constant || $body instanceof \Twig_Node_Expression_TempName) { return array($body, array()); @@ -182,4 +189,5 @@ protected function compileString(\Twig_NodeInterface $body) { return array(new \Twig_Node(array(new \Twig_Node_Expression_Constant(trim($msg), $body->getLine()))), $vars); } + } diff --git a/core/lib/Drupal/Core/Template/TwigTransTokenParser.php b/core/lib/Drupal/Core/Template/TwigTransTokenParser.php index a45f1d1..4071aff 100644 --- a/core/lib/Drupal/Core/Template/TwigTransTokenParser.php +++ b/core/lib/Drupal/Core/Template/TwigTransTokenParser.php @@ -16,7 +16,7 @@ * code into an Abstract Syntax Tree (AST). The AST will later be compiled * into PHP code usable for runtime execution of the template. * - * @see core\vendor\twig\twig\lib\Twig\TokenParser.php + * @see core/vendor/twig/twig/lib/Twig/TokenParser.php */ class TwigTransTokenParser extends \Twig_TokenParser { /** @@ -50,10 +50,16 @@ public function parse(\Twig_Token $token) { return $node; } + /** + * {@inheritdoc} + */ public function decideForFork($token) { return $token->test(array('plural', 'endtrans')); } + /** + * {@inheritdoc} + */ public function decideForEnd($token) { return $token->test('endtrans'); } @@ -65,6 +71,9 @@ public function getTag() { return 'trans'; } + /** + * {@inheritdoc} + */ protected function checkTransString(\Twig_NodeInterface $body, $lineno) { foreach ($body as $i => $node) { if ( @@ -81,4 +90,5 @@ protected function checkTransString(\Twig_NodeInterface $body, $lineno) { throw new \Twig_Error_Syntax(sprintf('The text to be translated with "trans" can only contain references to simple variables'), $lineno); } } + } diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigTransTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigTransTest.php index b2687f1..a9e17e9 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigTransTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigTransTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\system\Tests\Theme\TwigTransTest. + * Contains \Drupal\system\Tests\Theme\TwigTransTest. */ namespace Drupal\system\Tests\Theme; @@ -27,7 +27,15 @@ class TwigTransTest extends WebTestBase { ); protected $admin_user; + + /** + * Custom language code. + */ protected $langcode = 'xx'; + + /** + * LOL Speak machine name. + */ protected $name = 'Lolspeak'; public static function getInfo() { @@ -53,10 +61,6 @@ protected function setUp() { ); $this->writeSettings($settings); - // Rebuild the service container and clear all caches. - $this->rebuildContainer(); - $this->resetAll(); - // Create and log in as admin. $this->admin_user = $this->drupalCreateUser(array( 'administer languages', @@ -165,12 +169,12 @@ public function testTwigTransBlocks() { '', 'The "twig_debug" translation comment markup printed successfully for the above test.' ); - } /** * Helper function: import a standalone .po file in a given language. - * Borrowed from Drupal\locale\Tests\LocaleImportFunctionalTest. + * + * Borrowed from \Drupal\locale\Tests\LocaleImportFunctionalTest. * * @param $contents * Contents of the .po file to import. diff --git a/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php b/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php index cd809c8..6eb318a 100644 --- a/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php +++ b/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php @@ -38,5 +38,4 @@ public function transBlockRender() { ); } - }