Problem/Motivation

Look at this code, this is an inconsistent mess:

 <?php print render($title_prefix); ?>
  <?php if (!$page): ?>
  <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>" rel="bookmark"><?php print $label; ?></a></h2>
  <?php endif; ?>
  <?php print render($title_suffix); ?> 

Proposed resolution

I understand the need to call the label() method on the node object instead of directly referencing the $node->title, but I don't understand why that needs to trickle all the way down to the theme layer. Can we please be consistent with our variable names and call this a title? We can preprocess it in, or do it as part of the Twig __to_string() method on rendering a node.title but in the template file we should really be calling this a title.

Alternatively, we could rename everything else in these templates that contains "title" into a label. label_prefix, label_suffix, label_attributes.

Remaining tasks

- make our templates consistent

User interface changes

- none

API changes

- none

#1939224: Change block "label" so that it's called a title like everything else in the template file (and all other template files)
#1591806: Change block "subject" so that it's called a (admin_)label like everything else on the theme layer
#1591830: Change comment "subject" so that it's called a title like everything else in the template file (and all other template files)
#1825216: Name variables consistently across all templates (preprocess)
#2004966: Markup and variable cleanup for titles and attributes in all templates

Files: 
CommentFileSizeAuthor
#15 1939234-node-label-to-title-15.patch3.57 KBvks7056
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 89,782 pass(es), 12 fail(s), and 0 exception(s). View
#14 1939234-node-label-to-title-14.patch4.45 KBSethie
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 78,761 pass(es). View
#7 1939234-node-label-to-title-7.patch4.4 KBlahoosascoots
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch 1939234-node-label-to-title-7.patch. Unable to apply patch. See the log in the details link for more information. View
#3 1939234-node-label-to-title-3.patch4.98 KBjoelpittet
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch 1939234-node-label-to-title-3.patch. Unable to apply patch. See the log in the details link for more information. View

Comments

jenlampton’s picture

Issue summary: View changes

other

jenlampton’s picture

Issue summary: View changes

less snark

xmacinfo’s picture

I do not understand the need to call the label() method on the node object. Nevertheless, in the node template I agree, we should have $title, not $label.

The decision should be simple, use $title everywhere we need to display a title.

xmacinfo’s picture

Issue summary: View changes

A

dead_arm’s picture

Issue summary: View changes

Add related issue

xjm’s picture

Component: node.module » node system
Issue summary: View changes

(Merging "node system" and "node.module" components for 8.x; disregard.)

joelpittet’s picture

Status: Active » Needs review
FileSize
4.98 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch 1939234-node-label-to-title-3.patch. Unable to apply patch. See the log in the details link for more information. View
  • label to title
  • moved title_suffix/prefix up closer to the title in the dockbock
  • fixed one 80char doc issue.

Let's see if testbot has any grievances.

mlncn’s picture

Status: Needs review » Needs work

The last submitted patch, 3: 1939234-node-label-to-title-3.patch, failed testing.

mlncn’s picture

Issue tags: +Needs reroll

Worked 3 months ago so probably just needs re-roll.

lahoosascoots’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
4.4 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch 1939234-node-label-to-title-7.patch. Unable to apply patch. See the log in the details link for more information. View

Re-rolled

xmacinfo’s picture

Green! Do we need to patch only three files?

Berdir’s picture

I'm honestly not sure why node of all things was updated to use label, but the advantage of label is that it's the generic name on the entity level.

Comments have subjects (uses title in the template too, that's also weird), terms (uses name) and users have names (doesn't use anything in the template). All those things are exposed as the entity label.

But completely agree that having title_* and then label is weird., would have to be renamed consistently to label, better to be title consistently than what we have right now.

I suggest that you also update the $node->label() call to $node->getName(), wherever it's set.

Status: Needs review » Needs work

The last submitted patch, 7: 1939234-node-label-to-title-7.patch, failed testing.

mgifford’s picture

Issue tags: +Needs reroll
Sethie’s picture

Assigned: Unassigned » Sethie

I'll reroll it.

Sethie’s picture

Status: Needs work » Needs review
FileSize
4.45 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 78,761 pass(es). View

Here's the patch.

vks7056’s picture

Issue tags: -consistency, -Twig, -theme system cleanup, -Needs reroll +#SprintWeekend2015
FileSize
3.57 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 89,782 pass(es), 12 fail(s), and 0 exception(s). View
vks7056’s picture

Issue tags: -#SprintWeekend2015 +SprintWeekend2015
xmacinfo’s picture

Issue summary: View changes

Well done!

I did not apply the patch, though, so not marking RTBC.

mgifford’s picture

Status: Needs review » Reviewed & tested by the community

I applied the patch. Looks like a good change for consistency.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 15: 1939234-node-label-to-title-15.patch, failed testing.

Status: Needs work » Needs review
lauriii’s picture

Status: Needs review » Reviewed & tested by the community

Putting back because of random test failure

lauriii’s picture

Status: Reviewed & tested by the community » Needs work

I guess the beta evaluation could be added there actually..

xmacinfo’s picture

@lauriii: What do you mean by:

I guess the beta evaluation could be added there actually.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 15: 1939234-node-label-to-title-15.patch, failed testing.

lauriii’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 15: 1939234-node-label-to-title-15.patch, failed testing.

Cottser’s picture

Version: 8.0.x-dev » 9.x-dev
Assigned: Sethie » Unassigned
Status: Needs work » Postponed

Sorry, indeed this stuff is a bit of a mess as far as consistency, but postponing for the same reasons as #1939224-28: Change block "label" so that it's called a title like everything else in the template file (and all other template files).

catch’s picture

Version: 9.x-dev » 8.1.x-dev

I think we could duplicate the variable and update the template in a minor release, then remove the duplication in 9.x

Doesn't make it less messy in 8.x, but it does make it forward compatible with a less-messy 9.x.

Berdir’s picture

We could but the problem there is modules that are altering it in preprocess, they'd have to be updated to support both.

catch’s picture

We could do the duplication after preprocess runs.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.