Problem/Motivation
It's frustrating to have to print a title three different ways in three different templates. In node, we use label
, in comment we use title
and in blocks we use subject
. Here are some variables that should have the same name in all template files.
- title != label != subject
- name != author
- date != created
Even worse, in node and comment templates where the "Submitted by" information appears to be in exactly the same format once rendered on the page, those templates actually use completely different variables to create the output. If you change it in one place, and then go to change it in the other, your copy/paste from one template to the next will fail. Let's make it work instead.
Proposed resolution
We need to name these things consistently across all of drupal if we want people to feel at home here.
Remaining tasks
Rename bocks: #1591806: Change block "subject" so that it's called a (admin_)label like everything else on the theme layer
Rename comments: #1591830: Change comment "subject" so that it's called a title like everything else in the template file (and all other template files)
Decide what to do with node templates [#]
User interface changes
TBD.
API changes
TBD.
Related Issues
#2004966: Markup and variable cleanup for titles and attributes in all templates
Comments
Comment #0.0
jenlamptonall templates
Comment #0.1
jenlamptonadd explanation
Comment #1
BerdirNote that label (aka $entity->label()) is the unified .. well, label of an entity, so I guess it would make sense to use that in templates too?
The problem I see is that for example label for users feels a bit strange (or even worse, title, which is IMHO something else in the context of users..).
Comment #2
jenlamptonIf all entities have labels instead of title's now that's fine, but the UI everywhere still says "Title". People know that nodes have titles. People do *not* know that nodes have labels. I don't tink we should use $label in templates unless the UI starts to match. If the UI calls these things titles, we should call them titles in templates too.
P.S. I'm stealing this issue for the twig sandbox since that's where we'll be renaming all the variables :)
Comment #2.0
jenlamptonline break
Comment #3
jenlamptonchanging issue title / label / subject / whatever
Comment #4
BerdirRight, but the comment UI also uses subject, so why use title there? :) If that's the argument, then we'd need to change the comment UI too.
That's what I said. Nodes have titles, comments subjects, users and terms names... all are entities and entities have labels. So, if you want to use the same variable then technically, it should be label. That's equally confusing for every entity ;)
Alternatively, we could just keep the entity specific variable names (and revert the node change).
Comment #5
jenlamptonExactly. Why make everything equally confusing, when we could instead make everything equally clear?
We should revert the node change, and I think we should also fix comments and blocks to use 'title'. We need to be consistent. There's no good reason for a comment to have a "subject". Time for cleanup! :)
Comment #5.0
jenlamptonissue summary
Comment #5.1
dead_armAdd related issue
Comment #6
apadernoI am moving this issue back to Drupal core from the (now deleted) sandbox project used for the development of the theme engine that uses Twig.
I am also marking it as obsolete; feel free to re-open it if necessary.
I apologize for bumping this issue.