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.