When Automatic Nodetitles is enabled, and I go to admin/structure/types/manage/{my_content_type}, it takes >60 sec to load the page. I also have the impression it consumes a lot of memory.
Is it because the system is collecting all tokens?
In my system, auto_nodetitle vertical tab is the first in order, so I cannot test if the occurrs on 'show page' of 'show tab'
The list of tokens is not using the default 'Replacement patterns' Fieldset, which is used in many other places. Is there a reason for this difference?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

johnv’s picture

Title: Slow pageload when editing Content Type. » Slow pageload/Fatal error when editing Content Type.
Status: Active » Closed (works as designed)

I blame this on the token module.
Since a week the following error pops up, making contenttype edit page inaccessable:
Fatal error: Allowed memory size ... exhausted in ...\database\database.inc on line 2039
The following change removes the error and hides the node tokens, but shows that function theme_token_tree() in token.pages.inc has a caching problem:

  // Display the list of available placeholders if token module is installed.
  if (module_exists('token')) {
    $form['auto_nodetitle']['token_help'] = array(
      '#theme' => 'token_tree',
-      '#token_types' => array('node'),
    );
  }

Issue is to be resolved in #1068990: Optimize and add caching for theme_token_tree()

fonant’s picture

I get this, and in my case it's caused by having node reference fields to nodes with node reference fields. The token tree thus lists field tokens for nodes that are referenced by nodes that are referenced by nodes, quickly growing out of control.

More discussion here: #1252840: Node references + Entity Tokens creates HUGE Token Tree UI table HTML

For my site I fixed the problem temporarily with http://drupal.org/project/token_tweaks and setting a maximum depth of 2 for the token tree.

fonant’s picture

For automatic_nodetitles it would be really nice if the token system could provide a tree for just the current node type, and not for all possible node types. That would speed things up quite a bit.

Or perhaps we could add hook_tokens_alter() to automatic_nodetitles to strip out tokens for node types other than the one we're editing?

imclean’s picture

Status: Closed (works as designed) » Active

I'm not sure this issue has been resolved. #3 is a good suggestion. Disabling auto_nodetitle means I can actually access the Manage Content type page.

Szerge’s picture

After installin the module, when I try to edit a type (I can still manage the fields and displays, not the main edit), I've a fatal error, so I had to disable the module. I would like to go one step further, and desinstall it, but I can't. It's a real drag...

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2986337 bytes) in /home/web/drupal7/includes/database/database.inc on line 2168

Szerge’s picture

One more thing, now that I have disabled the module, each time I display a block, I have this error:

Notice: Undefined variable: source_fields in ddblock_form_alter() (line 1090 of /home/web/drupal7/sites/all/modules/ddblock/ddblock.module).

Which is probably connected to the fact that I still have the mapping option visible on the block (c.f. attachment).... Not very clean...

Szerge’s picture

And now that I've cleared the cache, I have one more error:

Warning: Invalid argument supplied for foreach() in form_select_options() (line 2674 of /home/web/drupal7/includes/form.inc).

peterbkk’s picture

Issue summary: View changes

i'm currently having this issue too, tokens slowing the page load.

johnv’s picture

In D7, replace this module with Automatic Entity Label, where I have no problems.
This module is not maintained. See also the project page for 'latest commit' and 'related module for D7'.

michaellenahan’s picture

I took a (ahem) 'pragmatic' approach and commented out the lines in #1 above.
I figure, I can live without the token generation help. In the event I will ever need it again, it will be when I am making a change on my local machine - in which case I can un-comment the lines again.

  // Display the list of available placeholders if token module is installed.
  // if (module_exists('token')) {
  //   $form['auto_nodetitle']['token_help'] = array(
  //     '#theme' => 'token_tree',
  //     '#token_types' => array('node'),
  //   );
  // }
  $form['auto_nodetitle']['token_help'] = array(
    '#markup' => t('Token help for auto_nodetitle has been commented out in code, for performance reasons (drupal.org/node/1115324).'),
  );
RgnYLDZ’s picture

#10 works for me. I have finished editing the title with tokens, so I don't need the list to load every time.

BTW for those who have the same problem; the code in #10 is in modules/auto_nodetitle/auto_nodetitle.module on line 181

sir_gon’s picture

Some friend give me this better tip.
To preserve function, but avoid slow loading of all available tokens, you can change the "theme" form field formatter to:

(for current stable version, in line 181)

   if (module_exists('token')) {
     $form['auto_nodetitle']['token_help'] = array(
-      '#theme' => 'token_tree',
+      '#theme' => 'token_tree_link',
       '#token_types' => array('node'),
     );
   }

Please try and merge the attached patch

alabandit’s picture

I can confirm the #12 works for me.
Thanks very much!

manoloka’s picture

I can confirm the #12 works for me too.
Thank you very much sir_gon !

michaellenahan’s picture

Status: Active » Reviewed & tested by the community

RTBC. I think #12 is ready to be committed.

mjgruta’s picture

This has been RTBC for a year, please commit. =)

imclean’s picture

Status: Reviewed & tested by the community » Closed (outdated)

This module has had no changes in 6 years and appears to be no longer supported. Try Auto Entity Label instead.