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

Remove $submitted variable and print string directly in template instead

$
0
0

Problem/Motivation

Front end devs often want to control the display of the submitted information, and tracking that down can be a real PITA. First, you look in the template file, and instead of the values you expect to find you see a variable $submitted. Okay, so maybe another template? No! A theme function? Nope! That's assembled using the t() function directly in preprocess... so you need to know about preprocess (and how to work them) just to change seemingly simple bit of output.

Proposed resolution

I propose something like this directlty in template files (below example is for node, but we should do the same for comments):

  {% if display_submitted %}
    <footer>
      {{ user_picture }}
      <p class="submitted">{{ 'Submitted by !username on !datetime'|t('!username':name, '!datetime':date) }}</p>
    </footer>
  {% endif %}

This also means less preprocessing! :)

Remaining tasks

- update node module
- update comment module
- update RDF mofdule
- locate any other places where submitted info is displayed and also update accordingly

User interface changes

- none

API changes

- none


Viewing all articles
Browse latest Browse all 294879

Trending Articles



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