diff --git a/core/includes/common.inc b/core/includes/common.inc index ff70536..7e2078d 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -398,7 +398,7 @@ function drupal_add_feed($url = NULL, $title = '') { */ function drupal_get_feeds($delimiter = "\n") { $feeds = drupal_add_feed(); - return implode($feeds, $delimiter); + return new Twig_Markup(implode($feeds, $delimiter), 'UTF-8'); } /** diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 5402dae..8f85cda 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2042,7 +2042,7 @@ function template_preprocess_html(&$variables) { $variables['html_attributes'] = $page->getHtmlAttributes(); $variables['attributes'] = $page->getBodyAttributes(); - $variables['page'] = $page->getContent(); + $variables['page'] = new Twig_Markup($page->getContent(), 'UTF-8'); // Compile a list of classes that are going to be applied to the body element. // This allows advanced theming based on context (home page, node of certain type, etc.). @@ -2252,7 +2252,7 @@ function template_preprocess_page(&$variables) { // @see menu_tree_page_data() $variables['breadcrumb'] = array( '#theme' => 'breadcrumb', - '#breadcrumb' => \Drupal::service('breadcrumb')->build(\Drupal::request()->attributes->all()), + '#breadcrumb' => new Twig_Markup(\Drupal::service('breadcrumb')->build(\Drupal::request()->attributes->all()), 'UTF-8'), ); } @@ -2468,7 +2468,7 @@ function template_preprocess_maintenance_page(&$variables) { $variables['attributes']['class'][] = 'sidebar-' . $variables['layout']; } - $variables['head'] = drupal_get_html_head(); + $variables['head'] = new RenderWrapper('drupal_get_html_head'); // While this code is used in the installer, the language module may not be // enabled yet (even maybe no database set up yet), but an RTL language @@ -2527,7 +2527,7 @@ function template_preprocess_install_page(&$variables) { */ function template_preprocess_region(&$variables) { // Create the $content variable that templates expect. - $variables['content'] = $variables['elements']['#children']; + $variables['content'] = new Twig_Markup($variables['elements']['#children'], 'UTF-8'); $variables['region'] = $variables['elements']['#region']; $variables['attributes']['class'][] = 'region'; diff --git a/core/lib/Drupal/Core/CoreServiceProvider.php b/core/lib/Drupal/Core/CoreServiceProvider.php index 098b165..7034eac 100644 --- a/core/lib/Drupal/Core/CoreServiceProvider.php +++ b/core/lib/Drupal/Core/CoreServiceProvider.php @@ -124,15 +124,12 @@ public static function registerTwig(ContainerBuilder $container) { // When in the installer, twig_cache must be FALSE until we know the // files folder is writable. 'cache' => drupal_installation_attempted() ? FALSE : settings()->get('twig_cache', TRUE), - 'base_template_class' => 'Drupal\Core\Template\TwigTemplate', - // @todo Remove in followup issue - // @see http://drupal.org/node/1712444. - 'autoescape' => FALSE, + 'autoescape' => TRUE, // @todo Remove in followup issue // @see http://drupal.org/node/1806538. 'strict_variables' => FALSE, - 'debug' => settings()->get('twig_debug', FALSE), - 'auto_reload' => settings()->get('twig_auto_reload', NULL), + 'debug' => TRUE, + 'auto_reload' => TRUE, )) ->addMethodCall('addExtension', array(new Definition('Drupal\Core\Template\TwigExtension'))) // @todo Figure out what to do about debugging functions. diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php index 9cd17b0..0a20859 100644 --- a/core/lib/Drupal/Core/Template/TwigExtension.php +++ b/core/lib/Drupal/Core/Template/TwigExtension.php @@ -17,18 +17,21 @@ * @see \Drupal\Core\CoreServiceProvider */ class TwigExtension extends \Twig_Extension { + + /** + * {@inheritdoc} + */ public function getFunctions() { - // @todo re-add unset => twig_unset if this is really needed return array( // @todo Remove URL function once http://drupal.org/node/1778610 is resolved. 'url' => new \Twig_Function_Function('url'), - // These functions will receive a TwigReference object, if a render array is detected - 'hide' => new TwigReferenceFunction('twig_hide'), - 'render_var' => new TwigReferenceFunction('twig_render_var'), - 'show' => new TwigReferenceFunction('twig_show'), + 'render_var' => new \Twig_Function_Function('twig_render_var'), ); } + /** + * {@inheritdoc} + */ public function getFilters() { return array( 't' => new \Twig_Filter_Function('t'), @@ -40,9 +43,14 @@ public function getFilters() { // @see TwigNodeTrans::compileString() 'passthrough' => new \Twig_Filter_Function('twig_raw_filter'), 'placeholder' => new \Twig_Filter_Function('twig_raw_filter'), + // @todo Consider renaming to 'exclude' or 'without'. + 'hide' => new \Twig_Filter_Function('twig_hide'), ); } + /** + * {@inheritdoc} + */ public function getNodeVisitors() { // The node visitor is needed to wrap all variables with // render_var -> twig_render_var() function. @@ -51,16 +59,16 @@ public function getNodeVisitors() { ); } + /** + * {@inheritdoc} + */ public function getTokenParsers() { return array( - new TwigFunctionTokenParser('hide'), - new TwigFunctionTokenParser('show'), new TwigTransTokenParser(), ); } - public function getName() - { + public function getName() { return 'drupal_core'; } } diff --git a/core/lib/Drupal/Core/Template/TwigFunctionTokenParser.php b/core/lib/Drupal/Core/Template/TwigFunctionTokenParser.php deleted file mode 100644 index 2d123cc..0000000 --- a/core/lib/Drupal/Core/Template/TwigFunctionTokenParser.php +++ /dev/null @@ -1,60 +0,0 @@ -tag = $tag; - } - - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance. - * - * @return Twig_Node_Print A Twig_Node_Print instance. - */ - public function parse(\Twig_Token $token) { - $lineno = $token->getLine(); - - $expr = $this->parser->getExpressionParser()->parseExpression(); - $this->parser->getStream()->expect(\Twig_Token::BLOCK_END_TYPE); - return new \Twig_Node_Print(new \Twig_Node_Expression_Function($this->tag, new \Twig_Node(array($expr)), $lineno), $lineno); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() { - return $this->tag; - } -} diff --git a/core/lib/Drupal/Core/Template/TwigNodeVisitor.php b/core/lib/Drupal/Core/Template/TwigNodeVisitor.php index 710faa0..b6cee84 100644 --- a/core/lib/Drupal/Core/Template/TwigNodeVisitor.php +++ b/core/lib/Drupal/Core/Template/TwigNodeVisitor.php @@ -19,74 +19,60 @@ class TwigNodeVisitor implements \Twig_NodeVisitorInterface { /** - * TRUE when this node is a function getting arguments by reference. - * - * For example: 'hide' or 'render' are such functions. - * - * @var bool - */ - protected $isReference = FALSE; - - /** - * Implements Twig_NodeVisitorInterface::enterNode(). + * {@inheritdoc} */ function enterNode(\Twig_NodeInterface $node, \Twig_Environment $env) { - if ($node instanceof \Twig_Node_Expression_Function) { - $name = $node->getAttribute('name'); - $func = $env->getFunction($name); - // Optimization: Do not support nested functions. - if ($this->isReference && $func instanceof \Twig_Function_Function) { - $this->isReference = FALSE; - } - if ($func instanceof TwigReferenceFunction) { - // We need to create a TwigReference - $this->isReference = TRUE; - } - } - if ($node instanceof \Twig_Node_Print) { - // Our injected render_var needs arguments passed by reference -- in case of render array - $this->isReference = TRUE; - } + + + // if ($node instanceof \Twig_Node_Expression_Function) { + // $name = $node->getAttribute('name'); + // $func = $env->getFunction($name); + + // // Optimization: Do not support nested functions. + // if ($this->isReference && $func instanceof \Twig_Function_Function) { + // $this->isReference = FALSE; + // } + + // } + // if ($node instanceof \Twig_Node_Print) { + // // Our injected render_var needs arguments passed by reference -- in case of render array + // $this->isReference = TRUE; + // } return $node; } - /** - * Implements Twig_NodeVisitorInterface::leaveNode(). - * - * We use this to inject a call to render_var -> twig_render_var() - * before anything is printed. - * - * @see twig_render + * {@inheritdoc} */ function leaveNode(\Twig_NodeInterface $node, \Twig_Environment $env) { if ($node instanceof \Twig_Node_Print) { - $this->isReference = FALSE; - $class = get_class($node); - return new $class( - new \Twig_Node_Expression_Function('render_var', new \Twig_Node(array($node->getNode('expr'))), $node->getLine()), - $node->getLine() - ); - } - - if ($this->isReference) { - if ($node instanceof \Twig_Node_Expression_Name) { - $name = $node->getAttribute('name'); - return new TwigNodeExpressionNameReference($name, $node->getLine()); + $exp = $node->getNode('expr'); + if ($exp instanceof \Twig_Node_Expression_Name) { + return new $class( + new \Twig_Node_Expression_Function('render_var', new \Twig_Node(array($exp)), $node->getLine()), + $node->getLine() + ); } - elseif ($node instanceof \Twig_Function_Function) { - // Do something! - $this->isReference = FALSE; + elseif($exp->hasAttribute('type') && $exp->getAttribute('type') == 'array') { + return new $class( + new \Twig_Node_Expression_Function('render_var', new \Twig_Node(array($exp)), $node->getLine()), + $node->getLine() + ); } - } + else { + + return $node; + } + + } return $node; } /** - * Implements Twig_NodeVisitorInterface::getPriority(). + * {@inheritdoc} */ function getPriority() { // We want to run before other NodeVisitors like Escape or Optimizer diff --git a/core/lib/Drupal/Core/Template/TwigReference.php b/core/lib/Drupal/Core/Template/TwigReference.php deleted file mode 100644 index 0b8b506..0000000 --- a/core/lib/Drupal/Core/Template/TwigReference.php +++ /dev/null @@ -1,131 +0,0 @@ -setReference($variable); - * @endcode - * - * When a TwigReference is accessed via the offsetGet method the resulting - * reference is again wrapped within a TwigReference. Therefore references to - * render arrays within render arrays are also retained. - * - * To unwrap TwigReference objects the reference can be retrieved out of the - * object by calling the getReference() method like this: - * @code - * $variable = &$obj->getReference(); - * @endcode - * This allows render(), hide() and show() to access the original variable and - * change it. The process of unwrapping and passing by reference to this - * functions is done transparently by the TwigReferenceFunctions helper class. - * - * @see TwigReferenceFunction - * @see TwigReferenceFunctions - */ -class TwigReference extends \ArrayObject { - - /** - * Holds an internal reference to the original array. - * - * @var array - */ - protected $writableRef = array(); - - /** - * Constructs a \Drupal\Core\Template\TwigReference object. - * - * The argument to the constructor is ignored as it is not safe that this will - * always be a reference. - * - * To set a reference use: - * @code - * $obj = new TwigReference(); - * $obj->setReference($variable); - * @endcode - * - * @param $array - * The array parameter is ignored and not passed to the parent - */ - public function __construct($array = NULL) { - parent::__construct(); - } - - /** - * Sets a reference in the internal storage. - * - * @param $array - * The array to set as internal reference. - */ - public function setReference(&$array) { - $this->exchangeArray($array); - $this->writableRef = &$array; - } - - /** - * Gets a reference to the internal storage. - * - * Should be called like: - * @code - * $reference = &$obj->getReference(); - * @endcode - * - * @return - * Returns the stored internal reference. - */ - public function &getReference() { - return $this->writableRef; - } - - /** - * Sets offset in internal reference and internal storage to value. - * - * This is just for completeness, but should never be used, because - * twig cannot set properties and should not. - * - * @link http://php.net/manual/en/arrayaccess.offsetset.php - * @param mixed $offset - * The offset to assign the value to. - * @param mixed $value - * The value to set. - */ - public function offsetSet($offset, $value) { - $this->writableRef[$offset] = $value; - parent::offsetSet($offset, $value); - } - - /** - * Retrieves offset from internal reference. - * - * In case of a render array, it is wrapped again within a TwigReference - * object. - * - * @param mixed $offset - * The offset to retrieve. - * - * @return mixed - * Returns a TwigReference object wrapping the array if the retrieved offset - * is a complex array (i.e. not an attribute). Else it returns the retrived - * offset directly. - */ - public function offsetGet($offset) { - if (!is_array($this->writableRef[$offset]) || $offset[0] == '#') { - return $this->writableRef[$offset]; - } - - // Wrap the returned array in a new TwigReference. - $x = clone $this; // clone is faster than new - $x->setReference($this->writableRef[$offset]); - return $x; - } -} diff --git a/core/lib/Drupal/Core/Template/TwigReferenceFunction.php b/core/lib/Drupal/Core/Template/TwigReferenceFunction.php deleted file mode 100644 index 6ca4cbd..0000000 --- a/core/lib/Drupal/Core/Template/TwigReferenceFunction.php +++ /dev/null @@ -1,14 +0,0 @@ -setReference($content); - * return $obj; - * } - * - * // [...] - * // Simplified, generated twig code - * $_content_ = getContextReference($content); - * - * Drupal\Core\Template\TwigReferenceFunctions::hide( - * getAttribute($_content_, 'links') - * ); - * @endcode - * A TwigReference object is passed to the __callStatic function of - * TwigReferenceFunctions. The method unwraps the TwigReference and calls the - * hide() method essentially with a reference to $content['links']. - * - * Therefore the hidden property is correctly set and a successive call to - * render() will not render the content twice. - * - * @see TwigReference - * @see TwigReferenceFunction - * @see TwigFactory - * - */ -class TwigReferenceFunctions { - - /** - * Magic function to call functions called from twig templates with a - * reference to the original variable. - * - * This checks if the array provided by value is containing a reference to - * the original version. If yes it replaces the argument with its reference. - * - * @param $name - * The name of the function to call. - * @param $arguments - * The arguments to process and pass to the called function. - * - * @return mixed - * Returns the output of the called function. - * - * @see TwigReference - */ - public static function __callStatic($name, $arguments) { - foreach ($arguments as $key => $val) { - if (is_object($val) && $val instanceof TwigReference) { - $arguments[$key] = &$val->getReference(); - } - } - - // Needed to pass by reference -- could also restrict to maximum one - // argument instead - $args = array(); - foreach ($arguments as $key => &$arg) { - $args[$key] = &$arg; - } - - return call_user_func_array($name, $args); - } -} diff --git a/core/lib/Drupal/Core/Template/TwigTemplate.php b/core/lib/Drupal/Core/Template/TwigTemplate.php deleted file mode 100644 index cb2d91d..0000000 --- a/core/lib/Drupal/Core/Template/TwigTemplate.php +++ /dev/null @@ -1,90 +0,0 @@ - $item))); - trigger_error($msg->getMessage(), E_USER_WARNING); - return NULL; - } - - // Return item instead of its reference inside a loop. - // @todo 'hide' and 'show' are not supported inside a loop for now. - // This should be a non-issue as soon as this lands: - // @see http://drupal.org/node/1922304 - if (isset($context['_seq'])) { - return $context[$item]; - } - - // The first test also finds empty / null render arrays - if (!$context[$item] || isset($this->is_no_reference[$item])) { - return $context[$item]; - } - - if (isset($context['_references'][$item])) { - return $context['_references'][$item]; - } - - // @todo Check if this is a render array (existence of #theme?) - if ((!isset($this->is_reference[$item])) && ($context[$item] instanceof \TwigMarkup || !is_array($context[$item]))) { - $this->is_no_reference[$item] = TRUE; - return $context[$item]; - } - - if ($this->twig_reference == NULL) { - $this->twig_reference = new TwigReference(); - } - $ref = clone $this->twig_reference; // clone is _much_ faster than new - $ref->setReference($context[$item]); - - // Save that this is a reference - $context['_references'][$item] = $ref; - $this->is_reference[$item] = TRUE; - - return $ref; - } -} diff --git a/core/modules/block/templates/block-list.html.twig b/core/modules/block/templates/block-list.html.twig index 873d192..fb5ee44 100644 --- a/core/modules/block/templates/block-list.html.twig +++ b/core/modules/block/templates/block-list.html.twig @@ -13,10 +13,9 @@ * @ingroup themeable */ #} -{% hide(form.place_blocks) %}
- {{ form }} + {{ form|hide('place_blocks') }}
{{ form.place_blocks }} diff --git a/core/modules/comment/templates/comment.html.twig b/core/modules/comment/templates/comment.html.twig index 570448f..5e2b080 100644 --- a/core/modules/comment/templates/comment.html.twig +++ b/core/modules/comment/templates/comment.html.twig @@ -7,8 +7,7 @@ * - author: Comment author. Can be a link or plain text. * - content: The content-related items for the comment display. Use * {{ content }} to print them all, or print a subset such as - * {{ content.field_example }}. Use hide(content.field_example) to temporarily - * suppress the printing of a given element. + * {{ content.field_example }}. * - created: Formatted date and time for when the comment was created. * Preprocess functions can reformat it by calling format_date() with the * desired parameters on the 'comment.created' variable. @@ -93,8 +92,7 @@ {# We hide the links now so that we can render them later. #} - {% hide(content.links) %} - {{ content }} + {{ content|hide('links') }} {% if signature %}
diff --git a/core/modules/node/templates/node-edit-form.html.twig b/core/modules/node/templates/node-edit-form.html.twig index eee9ecc..510f0c0 100644 --- a/core/modules/node/templates/node-edit-form.html.twig +++ b/core/modules/node/templates/node-edit-form.html.twig @@ -15,11 +15,9 @@ * @ingroup themeable */ #} -{% hide(form.advanced) %} -{% hide(form.actions) %}
- {{ form }} + {{ form|hide('advanced', 'actions') }}
{{ form.advanced }} diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index 1f8c823..2099e3c 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -17,9 +17,7 @@ * - published: Whether the node is published. * - label: The title of the node. * - content: All node items. Use {{ content }} to print them all, - * or print a subset such as {{ content.field_example }}. Use - * {% hide(content.field_example) %} to temporarily suppress the printing - * of a given element. + * or print a subset such as {{ content.field_example }}. * - user_picture: The node author's picture from user-picture.html.twig. * - date: Formatted creation date. Preprocess functions can reformat it by * calling format_date() with the desired parameters on @@ -94,8 +92,7 @@ {# We hide links now so that we can render them later. #} - {% hide(content.links) %} - {{ content }} + {{ content|hide('links') }}
{{ content.links }} diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigReferenceObjectTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigReferenceObjectTest.php deleted file mode 100644 index 88a4d22..0000000 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigReferenceObjectTest.php +++ /dev/null @@ -1,18 +0,0 @@ -nid = $nid; - $this->title = $title; - } -} diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigReferenceUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigReferenceUnitTest.php deleted file mode 100644 index 0f9534e..0000000 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigReferenceUnitTest.php +++ /dev/null @@ -1,147 +0,0 @@ - 'Theme Twig References', - 'description' => 'Tests TwigReference functions', - 'group' => 'Theme', - ); - } - - function setUp() { - parent::setUp(); - $this->variables = array( - 'foo' => 'bar', - 'baz' => array( - 'foo' => '42', - 'bar' => '23', - ), - 'node' => new TwigReferenceObjectTest( - 42, - 'test node' - ) - ); - } - - /** - * Test function for TwigReference class - */ - function testTwigReference() { - // Create a new TwigReference wrapper - $wrapper = new TwigReference(); - $wrapper->setReference($this->variables); - - // Check that strings are returned as strings - $foo = $wrapper['foo']; - $this->assertEqual($foo, $this->variables['foo'], 'String returned from TwigReference is the same'); - $this->assertTrue(is_string($foo), 'String returned from TwigReference is of type string'); - - // Check that arrays are wrapped again as TwigReference objects - $baz = $wrapper['baz']; - $this->assertTrue(is_object($baz), 'Array returned from TwigReference is of type object'); - $this->assertTrue($baz instanceof TwigReference, 'Array returned from TwigReference is instance of TwigReference'); - - // Check that getReference is giving back a reference to the original array - - $ref = &$baz->getReference(); - $this->assertTrue(is_array($ref), 'getReference returns an array'); - - // Now modify $ref - $ref['#hidden'] = TRUE; - $this->assertEqual($ref['#hidden'], $this->variables['baz']['#hidden'], 'Property set on reference is passed to original array.'); - $this->assertEqual($ref['#hidden'], $baz['#hidden'], 'Property set on reference is passed to wrapper.'); - - // Now modify $baz - $baz['hi'] = 'hello'; - - $this->assertEqual($baz['hi'], $this->variables['baz']['hi'], 'Property set on TwigReference object is passed to original array.'); - $this->assertEqual($baz['hi'], $ref['hi'], 'Property set on TwigReference object is passed to reference.'); - - // Check that an object is passed through directly - $node = $wrapper['node']; - $this->assertTrue(is_object($node), 'Object returned from TwigReference is of type object'); - $this->assertTrue($node instanceof TwigReferenceObjectTest, 'Object returned from TwigReference is instance of TwigReferenceObjectTest'); - } - - /** - * Test function for TwigReferenceFunctions class - */ - function testTwigReferenceFunctions() { - - // Create wrapper - $content = &$this->variables; - - // Use twig nomenclature - $context['content'] = $content; - - // Twig converts {{ hide(content.baz) }} to the following code - - // This will have failed, because getAttribute returns a value and not a reference - - try { - if (isset($context["content"])) { - $_content_ = $context["content"]; - } - else { - $_content_ = NULL; - } - TwigReferenceFunctions::hide($this->getAttribute($_content_, "baz")); - } - catch (Exception $e) { - // Catch the critical warning that a value was passed by reference - } - $this->assertFalse(isset($content['baz']['#printed']), 'baz is not hidden in content after hide() via value'); - - // Now lets do the same with some TwigReference magic! - - $content_wrapper = new TwigReference(); - $content_wrapper->setReference($content); - $context['content'] = $content_wrapper; - - // Twig converts {{ hide(content.baz) }} to the following code - - // This will succeed, because getAttribute returns a value, but it is an object - - if (isset($context["content"])) { - $_content_ = $context["content"]; - } - else { - $_content_ = NULL; - } - TwigReferenceFunctions::hide($this->getAttribute($_content_, "baz")); - - $this->assertTrue(isset($content['baz']['#printed']), 'baz is hidden in content after hide() via TwigReference object'); - - $type = TwigReferenceFunctions::gettype($this->getAttribute($_content_, "baz")); - $this->assertEqual($type, 'array', 'Type returned via TwigReferenceFunctions:: is an array.'); - - $type = gettype($this->getAttribute($_content_, "baz")); - $this->assertEqual($type, 'object', 'Type returned without TwigReferenceFunctions:: is an object.'); - } - - /** - * Helper function to somehow simulate Twigs getAttribute function - */ - public function getAttribute($array, $offset) { - if (isset($array[$offset])) { - return $array[$offset]; - } - - return NULL; - } -} diff --git a/core/modules/system/tests/modules/twig_extension_test/lib/Drupal/twig_extension_test/TwigExtension/TestExtension.php b/core/modules/system/tests/modules/twig_extension_test/lib/Drupal/twig_extension_test/TwigExtension/TestExtension.php index 93da633..3c2b851 100644 --- a/core/modules/system/tests/modules/twig_extension_test/lib/Drupal/twig_extension_test/TwigExtension/TestExtension.php +++ b/core/modules/system/tests/modules/twig_extension_test/lib/Drupal/twig_extension_test/TwigExtension/TestExtension.php @@ -8,7 +8,6 @@ namespace Drupal\twig_extension_test\TwigExtension; use Drupal\Core\Template\TwigExtension; -use Drupal\Core\Template\TwigReferenceFunction; /** * A test Twig extension that adds a custom function and a custom filter. diff --git a/core/modules/taxonomy/templates/taxonomy-term.html.twig b/core/modules/taxonomy/templates/taxonomy-term.html.twig index a3986fa..13be3c9 100644 --- a/core/modules/taxonomy/templates/taxonomy-term.html.twig +++ b/core/modules/taxonomy/templates/taxonomy-term.html.twig @@ -8,11 +8,7 @@ * - name: Name of the current term. * - content: Items for the content of the term (fields and description). * Use 'content' to print them all, or print a subset such as - * 'content.description'. Use the following code to temporarily suppress the - * printing of a given element: - * @code - * {% hide(content.description) %} - * @endcode + * 'content.description'. * - attributes: HTML attributes for the wrapper. The 'class' attribute * contains the following classes by default: * - taxonomy-term: The current template type, i.e. "theming hook". diff --git a/core/themes/bartik/templates/comment.html.twig b/core/themes/bartik/templates/comment.html.twig index ad03eb6..5e24380 100644 --- a/core/themes/bartik/templates/comment.html.twig +++ b/core/themes/bartik/templates/comment.html.twig @@ -7,8 +7,7 @@ * - author: Comment author. Can be a link or plain text. * - content: The content-related items for the comment display. Use * {{ content }} to print them all, or print a subset such as - * {{ content.field_example }}. Use hide(content.field_example) to temporarily - * suppress the printing of a given element. + * {{ content.field_example }}. * - created: Formatted date and time for when the comment was created. * Preprocess functions can reformat it by calling format_date() with the * desired parameters on the 'comment.created' variable. @@ -107,8 +106,7 @@ {# We hide the links now so that we can render them later. #} - {% hide(content.links) %} - {{ content }} + {{ content|hide('links') }}