I've applied the patch [1] to token module to enable fields token.
Auto_nodetitle works correctly except if the value of the token field is empty and the token string is displayed (i.e. [node:field-name:value] instead of empty string)
In attachment a patch fix this behaviour.

[1] http://drupal.org/node/691078#comment-4139738

Comments

fago’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.x-dev

I'm not sure the 'clear' options is really the right solution here, shouldn't the token be provided but be empty?

ownage’s picture

Patch doesn't install-- "Hunk #1 FAILED at 129."

Manually installing the patch renders a blank title when token fields are inserted.

dave reid’s picture

I'm not sure the 'clear' options is really the right solution here, shouldn't the token be provided but be empty?

No, this is what the clear option is for. Tokens do not and should not return anything if they do not have data. For example, if you have a token like [node:field_noderef:title] with a node that has no node reference data, this would burden the token code to have to pass something into the 'chained' token replacement for a node reference field so that something could be returned.

ownage’s picture

I had over 6 thousand nodes to update with this, so I went into the database via phpmyadmin and executed SQL to get rid of these. I found out if you import your content with Feeds, these tokens show up in the title.

SQL I used:

UPDATE node_revision SET title = replace(title,'[node:field-cinfo-mname] ','');
UPDATE node_revision SET title = replace(title,'[node:field-cinfo-fname] ','');
fago’s picture

Status: Active » Fixed

ad #3:
Makes sense. Thanks, committed.

Status: Fixed » Closed (fixed)

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

yoavi’s picture

Hi
Had the same problem with the 7.x-1.0 version
the patch worked for me

Imaaxa-Cory’s picture

This patch worked on my site also. I am wondering if this is going to be committed?

mdeltito’s picture

Another confirmation that this patch works as expected. This should be committed and merged.

Imaaxa-Cory’s picture

Please commit this patch.

festerm’s picture

Issue summary: View changes

I'm not sure if that's the cause, but after I update the Token module to 1.6 this behavior is happening again.

victoriachan’s picture

Thanks for this. This is already in the Dev branch. I have rerolled the patch for 7.x-1.0 for people not using dev branch.

Re #11, I'm using this with Token 1.6 with no issues.

higherform’s picture

Using patch #12 to ANT 7.x-1.0 with Token 7.x-1.6 . Behavior for empty tokens appears to be correct.

jim22’s picture

#12 worked for me. Thank you!