From 4a4cf380c569fbfeda15eb02f457751476385721 Mon Sep 17 00:00:00 2001 From: Bill Seremetis <6319-bserem@users.noreply.drupalcode.org> Date: Thu, 31 Aug 2023 11:53:31 +0000 Subject: [PATCH] Issue #3384540: Update 2.x -> 3.x documentation --- docs/migration-to-3.x.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/migration-to-3.x.md b/docs/migration-to-3.x.md index b2e58aa..081f438 100644 --- a/docs/migration-to-3.x.md +++ b/docs/migration-to-3.x.md @@ -7,6 +7,8 @@ Below are known BC breaks that may require updating your Twig templates. Twig Tweak 3.x requires Drupal 9, Twig 2 and PHP 7.3. ## Rendering entities + +### Entity ID is now required Entity ID parameter in `drupal_entity()` and `drupal_field()` functions is now mandatory. Previously it was possible to load entities from current route by omitting entity ID parameter. However, that was making Twig templates coupled @@ -33,6 +35,19 @@ function preprocess_page(array &$variables): void { } ``` +### Default view mode has changed +The view mode parameter in `drupal_field()` has changed from `default` to `full`. If you are using `drupal_field()` without specifying a view mode, you should update your templates to specify the `default` one. + +Before: +``` +{{ drupal_field('field_name', 'node', node.id) }} +``` + +After: +``` +{{ drupal_field('field_name', 'node', node.id, 'default') }} +``` + ## Rendering blocks `drupal_block()` now moves attributes provided by block plugin to the outer element. This may break some CSS rules.