Great module by the way. Thanks! Comes in very handy.

So in regards to my problem. I have a setup where I automatically set the node title with "Automatic Node Titles". It works great however it has problems using the serial token for new content. I think it's something to do with the module weight and that the serial has not yet been added to the Node for the module to grab through token and add to the title, if you know what I mean. Is there a solution to this?

There is a post on using NID as node title and it seems to be working fine.
http://drupal.org/node/194197

Thanks so much in advance.

Comments

kirsh’s picture

You are right -it is the same problem. Auto Node Titles builds titles during node save, and at that time neither nid nor serial field values are ready.

I think that the workaround is to use Rules instead of Auto Node Titles, as suggested on #194197: Use (T)NID as node title.

kirsh’s picture

Assigned: Unassigned » kirsh
Status: Active » Closed (fixed)
kirsh’s picture

Status: Closed (fixed) » Closed (works as designed)
ikeigenwijs’s picture

Version: 6.x-1.0-beta2 » 7.x-1.x-dev
Issue summary: View changes
Status: Closed (works as designed) » Active

This is still kind of an issue in drupal 7.x

The serial-field is available to use in auto entity label.
The title gets et correctly.
But the redirect after saving the content is not correctly filed in, at that point the serial is not filled in yet.
made an issue in tokens: https://www.drupal.org/node/2403989
But i don't know where the source of the problem lie, cant find it.
Set back to active-> the title gets saved correctly at one go, no rules or other hacks.

cameron prince’s picture

@ikeigenwijs: I am having a similar problem and I noticed this and your other posts in token and auto_entitylabel. I found a work around you might try.

I have AEL set up on a content type for storing quotes. A serial field (field_increment) provides a quote number that is used in the pathauto pattern as well as the title.

For reasons I have not been able to determine, this just recently stopped working. I was up to 99 quotes and today added 3 new ones. When the new quotes were created they had no path alias and their titles were missing the number. The [node:field_increment] token just started returning NULL for no apparent reason.

I added PHP code ( print $entity->field_increment[$language][0]['value']; ) to the AEL and this worked for the title, but was no help for pathauto.

Finally I decided to create my own token (quote-number) so that I could return a value, even if I had to do my own query or check $_REQUEST. I added the custom token to AEL and the pathauto pattern and it works again. I didn't have to do any queries either. Here's an excerpt from hook_tokens():

        case 'quote-number':
          if (!empty($data['node']) && $data['node']->type == 'quote') {
            $increment = field_get_items('node', $data['node'], 'field_increment');
            $replacements[$original] = !empty($increment) ? $increment[0]['value'] : 0;
          }
          break;
densolis’s picture

@cameronbprince,

Can you please post all of your code. I have the same issue, but don't know how to add a custom token. I compared your code to other examples on the web and I don't see how to reconcile your snippet to other examples on the web.

Thanks,

cameron prince’s picture

@densolis, the code excerpt is from hook_tokens(). See http://www.drupalfoo.com/drupal-7-creating-custom-token-user-defined-tag

MustangGB’s picture

Status: Active » Closed (won't fix)

As discovered in #615410: Auto Node-Title cannot use serial field auto_nodetitle has been superseded by auto_entitylabel, for which token do work and it's very easy to switch.