In uc_order_entity_info:
'entity keys' => array(
'id' => 'order_id',
'label' => t('Order'),
),
But documentation states that "label" inside the entity keys definition should be:
label: The name of the property that contains the entity label. For example, if the entity's label is located in $entity->subject, then 'subject' should be specified here. If complex logic is required to build the label, a 'label callback' should be defined instead (see the 'label callback' section above for details).
This makes any code that relies on "label" being a real property completely broken. Such as the entity reference module, or even parts of Core.
I've fixed this on a hook, just wanted to report here that t('Order') should be either:
* Completely removed
* Replaced by a property of the order (such as order_id)
* Removed + Add a "label callback"
Comment | File | Size | Author |
---|---|---|---|
#2 | 2788513-2.patch | 666 bytes | TR |
|
Comments
Comment #2
TR CreditAttribution: TR commentedThat line of code was added more than 6 years ago, when Drupal 7 was still in alpha. I suspect it was correct back then and that the Entity API changed underneath us without our noticing. You're the first person in all that time to encounter a problem with this!
In D8 this is done correctly - it's only an issue in the old D7 code. It seems this is a problem with both the order entity and the order product entity. For both of these, in D8, we don't use the label in the keys, so I vote for just removing this in D7 as well.
Comment #3
david_garcia CreditAttribution: david_garcia commentedStraightforward. Thanks!
Comment #4
yuraosn CreditAttribution: yuraosn as a volunteer and commentedThanks!
Comment #6
TR CreditAttribution: TR commentedCommitted. Thanks. And thanks for your patience.