Index: auto_nodetitle.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/auto_nodetitle/Attic/auto_nodetitle.module,v retrieving revision 1.20.2.5 diff -u -p -r1.20.2.5 auto_nodetitle.module --- auto_nodetitle.module 21 Apr 2009 08:52:10 -0000 1.20.2.5 +++ auto_nodetitle.module 12 Oct 2009 18:54:35 -0000 @@ -78,17 +78,18 @@ function auto_nodetitle_is_needed($node) * Sets the automatically generated nodetitle for the node */ function auto_nodetitle_set_title(&$node) { - $types = node_get_types(); + $type = node_get_types('type', $node->type); $pattern = variable_get('ant_pattern_'. $node->type, ''); + $nodetype = tt("nodetype:type:$node->type:name", $type->name); if (trim($pattern)) { $node->changed = time(); $node->title = _auto_nodetitle_patternprocessor($pattern, $node); } else if ($node->nid) { - $node->title = t('@type @node-id', array('@type' => $types[$node->type]->name, '@node-id' => $node->nid)); + $node->title = t('@type @node-id', array('@type' => $nodetype, '@node-id' => $node->nid)); } else { - $node->title = t('@type', array('@type' => $types[$node->type]->name)); + $node->title = t('@type', array('@type' => $nodetype)); } // With that flag we ensure we don't apply the title two times to the same node. $node->auto_nodetitle_applied = TRUE; @@ -125,10 +126,10 @@ 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. - * @return a title string - */ + * 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. + * @return a title string + */ function _auto_nodetitle_patternprocessor($output, $node) { if (module_exists('token')) { $output = token_replace($output, 'node', $node); @@ -143,8 +144,8 @@ function _auto_nodetitle_patternprocesso } /** - * Helper function for hook_form_alter() renders the settings per node-type. - */ + * Helper function for hook_form_alter() renders the settings per node-type. + */ function auto_nodetitle_node_settings_form(&$form) { $form['auto_nodetitle'] = array( '#type' => 'fieldset', @@ -245,3 +246,12 @@ function auto_nodetitle_node_type($op, $ break; } } + +/** + * provide a degrade path for function tt found in module i18nstrings + */ +if (! module_exists('i18nstrings') && ! function_exists('tt')) { + function tt($name, $string, $langcode = NULL, $update = FALSE) { + return t($string, array(), $langcode); + } +}