Browse Source

Issue #3384540: Update 2.x -> 3.x documentation

merge-requests/33/merge
Bill Seremetis 1 year ago committed by Ivan
parent
commit
4a4cf380c5
  1. 15
      docs/migration-to-3.x.md

15
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. Twig Tweak 3.x requires Drupal 9, Twig 2 and PHP 7.3.
## Rendering entities ## Rendering entities
### Entity ID is now required
Entity ID parameter in `drupal_entity()` and `drupal_field()` functions is now Entity ID parameter in `drupal_entity()` and `drupal_field()` functions is now
mandatory. Previously it was possible to load entities from current route by mandatory. Previously it was possible to load entities from current route by
omitting entity ID parameter. However, that was making Twig templates coupled 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 ## Rendering blocks
`drupal_block()` now moves attributes provided by block plugin to the outer `drupal_block()` now moves attributes provided by block plugin to the outer
element. This may break some CSS rules. element. This may break some CSS rules.

Loading…
Cancel
Save