Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293211

Add Twig Types to core templates

$
0
0

Problem/Motivation

In Twig 3.13 there is a new tag types introduced. It gives us the ability to declare the types of the template variables. See https://twig.symfony.com/doc/3.x/tags/types.html and https://github.com/twigphp/Twig/issues/4165

Proposed resolution

Add Twig types to all core templates based on the types in the template preprocess functions. For example block.html.twig could contain;

{#
/**
* ...
*
* @see template_preprocess_block()
*/
#}
{% types {
plugin_id: 'string',
label: 'string',
configuration: 'array',
in_preview: 'boolean',
content: 'array'
attributes: '\Drupal\Core\Template\Attribute',
...
} %}

...

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 293211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>