diff -rupN auto_nodetitle/auto_nodetitle.module auto_nodetitle_new/auto_nodetitle.module --- auto_nodetitle/auto_nodetitle.module 2009-02-10 21:06:09.000000000 +1100 +++ auto_nodetitle.module 2009-04-21 14:16:18.000000000 +1000 @@ -76,13 +76,22 @@ function auto_nodetitle_is_needed($node) /** * Sets the automatically generated nodetitle for the node + * @param node + * The node for which an auto node title is to be created. + * @param flush + * A flag that gets passed to the token module if the auto + * node title is created by the use of tokens. + * It indicates whether or not to flush the token cache. + * If you are creating auto node titles for multiple nodes + * in one go you should pass TRUE here to prevent incorrect + * title creation. The default is FALSE. */ -function auto_nodetitle_set_title(&$node) { +function auto_nodetitle_set_title(&$node, $flush_tokens = FALSE) { $types = node_get_types(); $pattern = variable_get('ant_pattern_'. $node->type, ''); if (trim($pattern)) { $node->changed = time(); - $node->title = _auto_nodetitle_patternprocessor($pattern, $node); + $node->title = _auto_nodetitle_patternprocessor($pattern, $node, $flush_tokens); } else if ($node->nid) { $node->title = t('@type @node-id', array('@type' => $types[$node->type]->name, '@node-id' => $node->nid)); @@ -127,11 +136,18 @@ function auto_nodetitle_operations_updat /** * Helper function to generate the title according to the PHP code. * Right now its only a wrapper, but if this is to be expanded, here is the place to be. + * @param flush + * A flag that gets passed to the token module if the auto + * node title is created by the use of tokens. + * It indicates whether or not to flush the token cache. + * If you are creating auto node titles for multiple nodes + * in one go you should pass TRUE here to prevent incorrect + * title creation. The default is FALSE. * @return a title string */ -function _auto_nodetitle_patternprocessor($output, $node) { +function _auto_nodetitle_patternprocessor($output, $node, $flush_tokens = FALSE) { if (module_exists('token')) { - $output = token_replace($output, 'node', $node); + $output = token_replace($output, 'node', $node, '[', ']', array(), $flush_tokens); } if (variable_get('ant_php_'. $node->type, 0)) { $output = auto_nodetitle_eval($output, $node);