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.

#2004966: Markup and variable cleanup for titles and attributes in all templates

Comments

jenlampton’s picture

Project: Drupal core »
Issue summary: View changes

all templates

jenlampton’s picture

Issue summary: View changes

add explanation

Berdir’s picture

Project: » Drupal core

Note 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..).

jenlampton’s picture

Project: Drupal core »
Version: 8.x-dev »
Component: theme system » Markup or variable cleanup (front-end branch)

If 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 :)

jenlampton’s picture

Issue summary: View changes

line break

jenlampton’s picture

Title: Name variables consistently in node and comment templates (preprocess) » Name variables consistently across all templates (preprocess)

changing issue title / label / subject / whatever

Berdir’s picture

Right, 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).

jenlampton’s picture

Exactly. 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! :)

jenlampton’s picture

Issue summary: View changes

issue summary

dead_arm’s picture

Issue summary: View changes

Add related issue

apaderno’s picture

Project: » Drupal core
Version: » 8.0.x-dev
Component: Markup or variable cleanup (front-end branch) » theme system
Issue summary: View changes
Status: Active » Closed (outdated)

I 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.