While trying to access the operation 'edit' for a Content Type, the interface of the page is dropped back to some basic text.
(I cannot say technically what is happening but the actual theme disappears, just simple text is visible, but does not offer any editing option any more).

As this module is based (or uses) token, I also cannot say if token is the problem or this module.
Both work indipendently, but not togehther.

So the ->edit 'Content Type' is possible without the token module installed but the auto nodetitle installed.
And the ->edit 'Content Type' is possible without the auto nodetitle module installed but the token module installed.

And of course without any of them installed.

Thank your for some advice.

Werner

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

skriptble’s picture

I'm having the exact same issue and it seems to have come from no where. I'm trying to trace my steps back. But your solutions of disabling automatic nodetitles and tokens works for me as well. Unfortunately I need both of them for the project I'm working on.

skriptble’s picture

I increased the memory limit from 128MB to 512MB in hope of fixing another problem with a module on my dev site and all of the sudden the whole pages started loading again. It still takes way too long for the pages to load, but at least the edit pages are loading again.

hansfn’s picture

Title: Editing of a 'Content Type' drops page interface » Memory exhausted when Token module enabled
Component: User interface » Code

This is a truly critical, or really fatal, issue.

There must be a memory leak some where. Is auto_nodetitle using the Token module in an in appropriate way? I tried increasing memory to 256MB and it wasn't enough: "PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 33742306 bytes)".

I would be more than happy to debug this, but don't know where to start.

hansfn’s picture

Title: Memory exhausted when Token module enabled » Memory exhausted when editing content type with Token module enabled

Just trying to make the title clearer.

jesss’s picture

I just ran into this issue and I'm pretty sure it boiled down to a fight between Token and Entity Tokens. Installing the Token Tweaks module and limiting the recursion to 2 solved it.

valthebald’s picture

I'm pretty sure the issue is caused by the following code (lines 181-187 in auto_nodetitle.module)

  // 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'),
    );
  }

No idea though how to fix it (except use token tweaks, which can be a nice ad hoc solution)

ricksta’s picture

I'm struggling with the automatic node titles module also.
What happens if you just comment out the code? Curious...have you tried that?

ricksta’s picture

awesome! token tweaks does the trick. thanks for the tip. fixed me right up.

mamanerd’s picture

Token Tweaks module worked for me too, thanks @jesss! Just in case anyone is wondering how to configure Token Tweaks settings, go here after enabling the module:

admin/config/system/tokens

P3t3r’s picture

So, any lookout for a fix in the module?

mautumn’s picture

Thanks @jesss - Token Tweaks - set at a maximum dept of 2 - worked for me also (neither 4 nor 3 worked - probably exceeding a php timeout?). This saved my bacon but I'm concerned for the lack of depth in tokens. It would be great if this could be fixed. We never had this problem in D6 - I wonder if the number and/or depth of tokens have spiralled in D7?

Thanks for sharing.

capellic’s picture

I was having this problem, too. Not only did it start causing memory exhausted errors out of nowhere, it generally caused performance to be terrible-- taking 8 seconds to load forms. I had thought it was CKEditor because that's above the fold on my forms. It would take forever to load. I discovered it was waiting on the complete token tree to load and then the JS for the tree had to parse to then collapse.

Thanks for the tip to use Token Tweaks-- a real life saver. Works great on a site with 128 MB allocated to memory.

pico34’s picture

Thanks @jesss ! Token_tweaks module is very useful to speed up the node-type page !

bendev’s picture

Hello,

I had the same issue with reference token with automatic node title.
Thanks for the suggestion to use token_tweaks. It solved the issue

capellic’s picture

Note that Token Tweaks may no longer be needed in newer versions of Token (7.x-1.2). I don't know the status of 6.x.

The token tree is loaded via AJAX on demand.
http://drupal.org/node/1684984

pico34’s picture

FileSize
527 bytes

You are right @capellic !
With the following patch, token_tweaks becomes useless

brulain’s picture

+ 1
This patch works fine, but nodes token are no more available.
Do you know why ?

pico34’s picture

Check if you have the last release of token module

brulain’s picture

No, this is not (1.3).
I have just updated in 1.4, and I see no changes.

dadderley’s picture

@jesss Thanks for the tip
I am using these:

  • Entity API 7.x-1.0-rc3
  • Token 7.x-1.4
  • Automatic Nodetitles 7.x-1.0
  • Entity reference 7.x-1.0-rc5

I have a lot of content types and a lot of fields.
When I installed Automatic Nodetitles 7.x-1.0, it started to take a while to load the main page for the individual content type pages (because it had to load all the darned token trees). I added more fields and content types, eventually I started getting out of memory errors.

I installed the Token Tweaks module and set the Maximum depth limit for the token UI to 2. Now everything works like a charm now.

It would be nice if the Automatic Nodetitles module was fixed as this is a real weakness in it.
But this is a good workaround.
This problem only really exists while doing development.
It shouldn't be a problem on a finished site.

I have the PHP memory limit on my server set really high.
I might try lowering it now to see what happens.

pico34’s picture

Same problem for me, (i'm in D6) nodes token are no more available with the patch (#16) (well, nodes token replace continues to work on node creation)

geraldito’s picture

Version: 7.x-1.x-dev » 7.x-1.0

As outlined by @capellic, Token Tweaks is no longer be needed in newer versions (since this patch: http://drupal.org/node/1684984) of Token. To load tokens with AJAX on demand change line 184 at auto_nodetitle.module from:

'#theme' => 'token_tree'

to

'#theme' => 'token_tree_link'

Tested with Token 7.x-1.4 and Automatic Nodetitle 7.x-1.0.

presleyd’s picture

Switching to the link is great but I also don't see node tokens. Just date, page, user, random and site info tokens in the modal.

presleyd’s picture

The token_tree_link theme doesn't take the same options as token_tree did. You can still use the token_tree theme and add an option for dialog.

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

Adding the options for dialog does the same thing but passes in the correct token_types options. The downside of this is that without token tweaks the page still has memory issues upon opening the modal. The edit page opens nice and quick though if you don't need to see the tokens though!

rodtatham’s picture

@dougzilla, like you my site had a lot of fields, & visiting the edit screen for any Content Type exhausted the server's memory allocation. The problem: lots of fields + Automatic Nodetitles + Tokens was proving too much work for the server, but:-

  1. installing the Token Tweaks module, then
  2. setting the Maximum depth limit for the token UI to 2 in the admin menu's 'Configuration->System->Tokens' screen

allowed me to successfully reduce the server's memory_limit setting in php.ini to a sane setting again (memory_limit = 256M is now fine).

Thanks to this thread for putting me on the right track!

rooby’s picture

Status: Active » Closed (duplicate)

+1 for #25 as a temporary solution. Not a great solution but a viable workaround.

This really isn't an autonodetitle problem (there is nothing wrong with the auto nodetitle token usage), it is a token module problem, and if you are using entity tokens, it is possibly also an entity token module problem.

This is really a duplicate of these issues:
#1058912: Prevent recursive tokens
#1203018: Memory timeout with entity tokens and token module

johnnybgoode’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Issue summary: View changes
Status: Closed (duplicate) » Needs review
FileSize
405 bytes

This really isn't an autonodetitle problem (there is nothing wrong with the auto nodetitle token usage), it is a token module problem,

Rooby, please don't be so quick to dismiss issues. As pico34, geraldito and presleyd have stated above, this issue can in fact be fixed within auto_nodetitle since token-7.x-1.2. There is already a patch in #16, and I'm attaching a patch with with presleyd's alternate suggestion from #24. Let's get one of these committed so that token_tweaks is no longer necessary just to load the content type edit page (although it may still be necessary to view the token browser).

rooby’s picture

Sure that makes sense.
It's a helpful interim work around for using the pages in question, although it doesn't fix the underlying problem.

Elijah Lynn’s picture

Status: Needs review » Reviewed & tested by the community

#27 works, and now a token link that when clicked shows a dialog with the missing 'node' tokens and all the other crap that is slowing tokens down. Yeah there is an underlying performance issue with tokens but this patch needs to get in to make forms load at a normal speed.

Elijah Lynn’s picture

Elijah Lynn’s picture

As rooby says, the issue is actually Entity tokens.

Also...

Dave Reid says in https://www.drupal.org/node/1203018#comment-4957036,

"The simple fact is that Entity tokens set the token tree up for failure by overloading it with more tokens and chaining than it was ever anticipated."

and then suggests a solution in #1229568: Token UI 2.0...

"Use AJAX when a user wants to view nested tokens (get deeper in the token tree) - then we will only have to load the first level of tokens by default. Getting further will require relatively small request each time."

and then there is this patch for Drupal 8 that I haven't reviewed yet.. #514990: Add a UI for browsing tokens

Elijah Lynn’s picture

vivdrupal’s picture

This works for me perfectly Token Tweaks - tweaking the depth to 2.

Had been trying to solve it for months ! Thanks.

Anonymous’s picture

For those not wanting to have to change community code directly for VCS; you can just set the auto_nodetitle module weight to be lighter than a module you create a hook_form_FORM_ID_alter for:

// if there is an auto_nodetitle form to edit
if (isset($form['auto_nodetitle']['token_help'])) {
$form['auto_nodetitle']['token_help']['#dialog'] = TRUE;
}

Obviously just based on the patch from above.

aksdax’s picture

Token Tweaks for the win :)
Thanks for the tip.

rooby’s picture

Token tweaks for the workaround. I wouldn't call it a win :)

MustangGB’s picture

#27 is working as a work-around for me until Token/Entity decide how to do this nicely (hint: AJAX would be pretty sexy).

ilami’s picture

jesss commented 3 years ago
I just ran into this issue and I'm pretty sure it boiled down to a fight between Token and Entity Tokens. Installing the Token Tweaks module and limiting the recursion to 2 solved it.

Thanks!!!

MarleneSSI’s picture

Just in case some people are suffering from the same problem and don't want to disable Entity token, i found in my setting.php this line of code (and i don't know who put it there :/) ini_set('memory_limit', '256M'); i just commented it and the problem is solved.

rooby’s picture

@MarleneSSI:
I recommend being cautious when changing web server configuration if you are not familiar with the possible consequences.
By changing the PHP memory limit you could potentially negatively affect the performance/scalability/reliability of your website.

Often (not always) you will find that settings like that have been configured a certain way for a reason.

bradallenfisher’s picture

wow token tweaks works like a charm. Thanks!

jenlampton’s picture

+1 on RTBC.

Road Kill’s picture

Token Tweaks worked for me.

leymannx’s picture

After all the years #5 still valid: https://www.drupal.org/project/token_tweaks

gaurav.kapoor’s picture

I didn't get any kind of timeout error when accessing the content type edit page. Let me know if anybody is still facing this issue.

gaurav.kapoor’s picture

Status: Reviewed & tested by the community » Fixed
gaurav.kapoor’s picture

Pushed #27 for the time being as many have faced issues because of it, Although I wasn't able to reproduce the issue. Please create new issues in case you find any other bugs in this module.

Status: Fixed » Closed (fixed)

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

AswathyAjish’s picture

Me also had the same problem.

Now I upgraded the module from 7.x-1.0 to 7.x-2.0-alpha1 version. Now the add and edit content type page is loading. But for the "Automatic title generation", the tokens are not loading.

For that, I installed the module "Token tweaks" and set the depth to 2. Now the tokens are also loading.

Thanks for the solution.

parth.kukadiya’s picture

token_tweak module and its configuration worked for me.

Titus Rukenya’s picture

Related issues: +#2857517: Drupal 8 version

How do we solve this problem in drupal 8?