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

Accessing the original entity in field templates is hard

$
0
0

Problem/Motivation

Let's make a field template and access some date from the entity:

datetime = element['#object'].getCreatedTime|format_date('html_datetime')

That's less than ideal.

Proposed resolution

Provide at least entity by adding it in template_preprocess_field

$variables['entity'] = $element['#object'];

Remaining tasks

User interface changes

API changes

Data model changes


Viewing all articles
Browse latest Browse all 298857

Latest Images

Trending Articles



Latest Images

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