Hi,

At line 588 in your .module you do

if (title_field_replacement_enabled($context['type'], $entity->type, $legacy_field)) {

but when the entity is a comment, it has no property "type" and an error occured.

You could use something like that to patch the bug :

if (title_field_replacement_enabled($context['type'], isset($entity->type) ? $entity->type : $context['type'], $legacy_field)) {

Regards.

Comments

epieddy’s picture

Priority: Normal » Major

Up

plach’s picture

Priority: Major » Normal

I think the right fix is using entity_extract_ids() to get the bundle in a generic fashion. Patch welcome.

plach’s picture

dave reid’s picture

This problem is in two parts. Title module assumes that $context['type'] is in fact an entity type string when it fact it is not. Core uses 'taxonomy_term' for an entity type, but 'term' for the token type. So we need to address this.

plach’s picture

@Dave Reid:

What about adding an entity info key somewhere to map token types to entity types?

joelrotelli’s picture

Hi,

I have made a patch for this from the fix proposed by epieddy .

peximo’s picture

Status: Active » Needs review
StatusFileSize
new2.56 KB

Hi, there's already a key that maps the entity type and the token, the attached patch should fix the bug using this mapping.
I did some tests with pathauto and seems to work properly.

plach’s picture

Issue tags: +Needs tests

Looks good, thanks! It would be great to have some tests for this.

plach’s picture

Can anyone here tell us whether the patch in #7 fixes his issue?

plach’s picture

Status: Needs review » Fixed

Ok, committed and pushed #7. It would still be good to get some tests for this.

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.

  • Commit 23f7e20 on 7.x-1.x, workbench authored by peximo, committed by plach:
    Issue #1482052 by peximo | joel rotelli, epieddy: Fixed Undefined...