We have this issue with Workbench enabled OrganicGroups Nodes which have a Title Replacement.

During saving a new draft (not published) the OG Entity is updated and loads the Entity Label which is callbacked by Title Module.
The Title Module then want's to load the title replacement but fails because the node is still in draft or somehow (did not make very much digging inside of the entity_metadata_wrapper() function). OG realises that the label is empty and changes the label to "Entity ID XX", which is a UX problem for the User, he cannot search for his GroupName anymore.

So the overall problem is that title_field_text_sync_get() does return NULL. So I added an additional check in the title_entity_label function that if the returned label is not set it falls back to the original title field.

I know that this case is really rare. And the fix is not the best, because the original title field should not be used if there is a replacement field. Also we could blame OG or even Workbench to update the OG Entity during saving a Draft. But they all use the Core APIs for the labels and the problem is actually caused inside of the Title Module.

Comments

schnitzel’s picture

StatusFileSize
new762 bytes
plach’s picture

Status: Needs review » Needs work

No time to test this properly but the change looks sane, can you fix the extra space after = and the trailing whitespace below? A simpletest showing the bug would help too.

+++ b/title.module
@@ -90,11 +90,12 @@ function title_entity_label($entity, $type, $langcode = NULL) {
+    $label =  $info['callbacks']['sync_get']($type, $entity, $legacy_field, $info, $langcode); ¶