commit 127cd920c9f2bce49492cdbb46d9efe3629ae3d7 Author: Joel Pittet Date: Thu Jan 16 17:53:47 2014 -0800 fixes diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php index 28e96aa..0631a28 100644 --- a/core/lib/Drupal/Core/Template/TwigExtension.php +++ b/core/lib/Drupal/Core/Template/TwigExtension.php @@ -17,11 +17,8 @@ * @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'), @@ -30,9 +27,6 @@ public function getFunctions() { ); } - /** - * {@inheritdoc} - */ public function getFilters() { return array( 't' => new \Twig_Filter_Function('t'), @@ -44,14 +38,10 @@ 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'), + 'without' => new \Twig_Filter_Function('twig_without'), ); } - /** - * {@inheritdoc} - */ public function getNodeVisitors() { // The node visitor is needed to wrap all variables with // render_var -> twig_render_var() function. @@ -60,16 +50,14 @@ public function getNodeVisitors() { ); } - /** - * {@inheritdoc} - */ public function getTokenParsers() { return array( new TwigTransTokenParser(), ); } - public function getName() { + public function getName() + { return 'drupal_core'; } } diff --git a/core/modules/block/templates/block-list.html.twig b/core/modules/block/templates/block-list.html.twig index fb5ee44..474c654 100644 --- a/core/modules/block/templates/block-list.html.twig +++ b/core/modules/block/templates/block-list.html.twig @@ -15,7 +15,7 @@ #}
- {{ form|hide('place_blocks') }} + {{ form|without('place_blocks') }}
{{ form.place_blocks }} diff --git a/core/modules/comment/templates/comment.html.twig b/core/modules/comment/templates/comment.html.twig index 5e2b080..c26b4b6 100644 --- a/core/modules/comment/templates/comment.html.twig +++ b/core/modules/comment/templates/comment.html.twig @@ -7,7 +7,11 @@ * - 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 }}. + * {{ content.field_example }}. Use following code to temporarily suppress the + * printing of a given child element: + * @code + * {{ content|without('field_example') }} + * @endcode * - 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. @@ -92,7 +96,7 @@ {# We hide the links now so that we can render them later. #} - {{ content|hide('links') }} + {{ content|without('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 510f0c0..c208cf5 100644 --- a/core/modules/node/templates/node-edit-form.html.twig +++ b/core/modules/node/templates/node-edit-form.html.twig @@ -17,7 +17,7 @@ #}
- {{ form|hide('advanced', 'actions') }} + {{ form|without('advanced', 'actions') }}
{{ form.advanced }} diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index 2099e3c..55d5589 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -17,7 +17,9 @@ * - 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 }}. + * or print a subset such as {{ content.field_example }}. Use + * {{ content|without('field_example') %} to temporarily suppress the printing + * of a given child element. * - 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 @@ -92,7 +94,7 @@ {# We hide links now so that we can render them later. #} - {{ content|hide('links') }} + {{ content|without('links') }}
{{ content.links }} diff --git a/core/modules/taxonomy/templates/taxonomy-term.html.twig b/core/modules/taxonomy/templates/taxonomy-term.html.twig index 13be3c9..2ecc713 100644 --- a/core/modules/taxonomy/templates/taxonomy-term.html.twig +++ b/core/modules/taxonomy/templates/taxonomy-term.html.twig @@ -8,7 +8,11 @@ * - 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'. + * 'content.description'. Use the following code to exclude the + * printing of a given child element: + * @code + * {{ content|without('description') }} + * @endcode * - 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 5e24380..cfc56f6 100644 --- a/core/themes/bartik/templates/comment.html.twig +++ b/core/themes/bartik/templates/comment.html.twig @@ -7,7 +7,11 @@ * - 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 }}. + * {{ content.field_example }}. Use following code to temporarily suppress the + * printing of a given child element: + * @code + * {{ content|without('field_example') }} + * @endcode * - 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. @@ -106,7 +110,7 @@ {# We hide the links now so that we can render them later. #} - {{ content|hide('links') }} + {{ content|without('links') }}