Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
entity system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Jun 2012 at 14:59 UTC
Updated:
29 Jul 2014 at 20:48 UTC
Jump to comment: Most recent file
Comments
Comment #1
fagotrying to improve the issue title.
More details using the node example:
When linking to a node the node->label() is used instead of the node title. But when something specifically refers to the node title, as $title in templates - we've been staying with the node title. Considering that the label property can be altered, it would be weird to don't get the title in $title. So, if we want to go with entity labels in the templates as well it should probably be $label or $entity_label, while $title could be available as well.
Comment #2
schnitzel commentedI spoke with some themers at the coding sprint drupalcon munich (mortendk and others).
they agreed that we should use the same terminology for the themers and the developers.
Because it makes no real sense to show the title (node.tpl.php and taxonomy_term.tpl.php are mostly used to show something to the user) we agreed to use the label instead. To not confuse themers we remove the $title completly.
attached patch does this.
I also wanted to first change the $title_prefix and $title_attributes variables. but I saw in block.tpl.php this:
so we are already mixing title and non title things, which I decided to not change $title_prefix to $label_prefix
Comment #3
schnitzel commentedComment #4
gábor hojtsyBased on all the feedback you got and the cross-check with existing subsystems, I think this should be ready to go.
Comment #5
berdirThis change looks good to me, I agree with everything in #2.
Note that there's also $name a few lines above. I think we should actually just have $label and remove $name and $term_name.
Comment #6
berdirOh, cross-post. Re-adding tags. I do think the $name/$term_name thing should be fixed. Given that $term_name is used in the template, $name might not even exist and might just be a documentation bug.
Comment #7
schnitzel commented@Berdir
yes, there is already a patch for this: #1751054: Taxonomy template variables are getting merged with the term itself (security aspects of $name variable were documented wrong)
Comment #8
berdirAh, yes, if there's already an issue then this is fine with me. Still not 100% about $term_label vs. $label.
Comment #9
schnitzel commenteddiscussed with Berdir in IRC, we agreed to unify the variables so that they are the same in node.tpl.php
Comment #10
berdirLooks good. Will conflict with #1637342: Add entity_url() and entity_l() wrapper functions to simplify using EntityInterface::uri(), might make sense to get that one in first.
Comment #11
catchHmm the other one is already CNW for a re-roll, so I'm going to go ahead and commit this so it's out of the way. This all seems reasonable to me. Committed/pushed to 8.x.
Comment #12
gábor hojtsyChange notice posted at http://drupal.org/node/1776718 (aimed at themers, although twig might change this altogether anyway :D) I don't think this deserves a CHANGELOG.txt entry, so off we go (off from the sprint that is). Thanks all!
Comment #14
webchickNote that this caused XSS vulnerabilities in D7 templates that are ported to D8: #1811684: XSS: Bartik's node.tpl.php prone to XSS (prints $title)