Needs work
Project:
Drupal core
Version:
main
Component:
entity system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Feb 2014 at 00:33 UTC
Updated:
3 Nov 2025 at 16:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
larowlanLets see what bot says
Also Feeds and Messages have setTitle - possible use-case to implement there too?
Comment #3
sandrey commentedThe task will be resolved during Summer Drupal Code Sprint Novosibirsk 2014 #1
Comment #4
sandrey commentedby sandrey and Andrew.Mikhailov
best regards!
Comment #5
sandrey commentedComment #6
sandrey commentedPlease review
Comment #7
Crell commentedShould the getter method also move to this interface, or is there a good reason to keep those separate?
Comment #8
sandrey commentedI think the correct solution is to move the getter method to this interface.
Comment #9
tim.plunkettYou don't need to redefine this method at all.
Comment #10
andrew.mikhailov commentedThanks!
Comment #11
sandrey commentedThe patch has been updated according to #7 and #9 comments. tim.plunkett thanks, that's good point.
by sandrey and Andrew.Mikhailov
Best regards!
Comment #12
tim.plunkettDoesn't need the extra line here.
getLabel should return a string.
Actually, why do we even have this? We should just be moving EntityInterface::label() to this interface, right?
I think we should use the $this->get('subject')/$this->set('subject') bit directly here.
Comment #13
sandrey commentedcorrected
Comment #17
sandrey commentedComment #18
tim.plunkettPlease remove getLabel() from everywhere. It should always be label()
Comment #20
andypostComment #21
berdirI don't really understand the reason for this issue, what is the use case for setting the label of an entity without knowing what kind of entity it is?
The label is by the current definition read-only by design and might be altered and not the same as the username, for example. Users are messed up right now, but with #2112679: getUsername() should return the username getDisplayName() for the formatted user name, getUsername() will return the raw username, while getDisplayName()/label() will return a possibly altered (for example by realname.module) username. So what would $user->setLabel() then do exactly?
Comment #22
andypost@berdir the primary reason is DX, the only confusing thing in the proposed is messing of
hasKey('label')and newlyinstance_of EntityLabeledInterfaceotoh we have a
EntityChangedInterfaceandEntityOwnerInterfaceso subject looks sane.So what would $user->setLabel() then do exactly?getDisplayName() != label()is you saidlabel()is readonly property it can't be a renderable/rendered stuff and result should be always sanitized.As we have now
label()- Returns the label of the entity. and once entity implements proper interface that result could be changed with defined method. This would allow contrib authors much easy operate with entities.Comment #23
sutharsan commentedRerolled. Changed in core:
* hook_comment_presave() removed.
* Method randomName() renamed to randomMachineName()
Comment #27
daffie commentedThis will not pass the beta changes. Postponed to version 8.1.x, but most probably postponed until 9.x.
Comment #32
colanComment #44
smustgrave commented