In order for tokens to be evaluated during Views Bulk Operations or an import script or other non standard process, we need to get away fro mthe current strategy of adding a submit handler on the node form. The attached patch moves this logic to nodeapi('presave').

Comments

fago’s picture

indeed, that's missing quite a time..

I took your patch and improved it a bit. Most important I modified it to keep the old behaviour only when the preview button is pressed, this lets the node preview keep working with the autogenerated title. Then I optimized the nodeapi implementation and fixed its comment.
-> committed to 6.x-dev, please test.

fago’s picture

Status: Needs review » Fixed

I've just ported this to 5.x-dev too - please test!

moshe weitzman’s picture

Status: Fixed » Needs work

looking at http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/auto_nodeti.... You are assigning stuff to $settings bbut never using that. Perhaps that wqhy some claim this does not work. see http://drupal.org/node/321611#comment-1186332

fago’s picture

It's used - in the next part of the if clause and also it's checked that $settings == TRUE with the assignment.

In my tests it did work fine - perhaps you could give it a test too?

Anonymous’s picture

I'm not too sure if this is the proper issues to report my test, however with the latest dev version for 6 this does not work with computed fields. Anyway to fix this issue?

asb’s picture

Status: Fixed » Needs work

Hi,

I downloaded http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/auto_nodeti..., but can't see any changes regarding the tokens availabe at /admin/content/types (I followed the trail from an issue of Computed field not making it's values availabe as Tokens).

I just wanted to enter the value from this 'auto_increment' field into the node title... which seems to be impossible in Drupal... Sigh...

Greetings, -asb

fago’s picture

Status: Needs work » Fixed

computed field should provide a token.

Anyway this issue is about something different, which should be fixed. Reopen, if there are troubles with that.

asb’s picture

Issue posted in Computed Field issue queue.

And no, at least for D5 the "computed field" does not provide a token, at least none I could find within the replacement patterns provided by "auto nodetitle".

Greetings, -asb

drewish’s picture

Status: Needs work » Fixed

i was about to chime in that this totally wasn't work then realized that the last stable release was over six months ago. so now that there's some cool new features like this in there could we get a new release so that people won't be opening duplicate issues like: #360359: Batch update node titles (for D6)

fago’s picture

yep, that's my intention. I just wanted to wait a few days so I see whether people have troubles with it.

Status: Fixed » Closed (fixed)

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

manuel garcia’s picture

I'm a bit confused here, does the latest stable 6.x release have this in? It doesn't seem to.... :X

manuel garcia’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new36.41 KB

Here's a reroll of the patch for the latest 6.x, with a small change that only access the $settings if op is presave (and not everytime).

manuel garcia’s picture

Ooops!

Completely ignore the previous patch, i made it in the wrong installation lol.

Here's the good one

manuel garcia’s picture

Status: Needs review » Closed (fixed)

OK, completely ignore my previous comments... and dont try that patch, it'll break your installation.

there's already a hook_nodeapi implementation:

function auto_nodetitle_nodeapi(&$node, $op) {
  if ($op == 'presave' && auto_nodetitle_is_needed($node)) {
    auto_nodetitle_set_title($node);
  }
}