Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Creating or editing a node where I was using auto_entitylabel would result in a blank title. I flushed the cache, and it worked again. The problem is that I have no idea what caused it. That means I have no idea how to prevent it.
Any ideas?
Comments
Comment #1
bforchhammer CreditAttribution: bforchhammer commentedIt sounds like it could be a caching problem, so if you're using something like the EntityCache module try disabling it and see if that fixes it.
Otherwise I'm afraid I won't be able to help unless you can give me a set of steps which allow me to reproduce your problem on a fresh drupal installation...
Comment #2
redndahead CreditAttribution: redndahead commentedI know this is old, but I was able to reproduce this issue. I'll say we are using workbench so that may have some effect, but we have been using this module fine until all of a sudden it stopped working. Clearing the cache fixed it.
Comment #3
martin74 CreditAttribution: martin74 commentedI have the same issue.
when creating a product the title isnt generated.
After edditing the product , save the variation and the product the title is there.
It seems it cant get whats not there (yet)
Comment #4
bforchhammer CreditAttribution: bforchhammer commented@Martin_s: if your title is only blank the first time you save the entity, then it's probably related to #1445124: Add support for entity id tokens during creation, which has been fixed in the development version of the module.
Comment #5
martin74 CreditAttribution: martin74 commented@bforchhammer
the problem is that im running a Kickstart commerce and installed auto entity with it
when i enable auto entity as a module i get %AutoEntityLabel% as result in the title
If i dont , i get nothing on 1st save
Comment #6
martin74 CreditAttribution: martin74 commentedIt seems to work after a uninstall and install of the module
unfortunate with a red box warning, but its there
Notice: Undefined index: nl in auto_entitylabel_set_title() (regel 246 van /var/www/vhosts/xxx/httpdocs/sites/all/modules/auto_entitylabel/auto_entitylabel.module).
Notice: Undefined index: en in auto_entitylabel_set_title() (regel 246 van /var/www/vhosts/xxx/httpdocs/sites/all/modules/auto_entitylabel/auto_entitylabel.module).
Code from line 243 and on
// Save titles on entity (field)
if (module_exists('title') && (title_field_replacement_enabled($type, $bundle, $settings['title']))) {
foreach ($titles as $lang => $title) {
if ($entity->{$title_field_name}[$lang][0]['value'] != $title) {
$entity->{$title_field_name}[$lang][0]['format'] = NULL;
$entity->{$title_field_name}[$lang][0]['safe_value'] = check_plain($title);
$entity->{$title_field_name}[$lang][0]['value'] = $title;
$entity->auto_entitylabel_changed = TRUE;
}
}
}
i use Pattern for the title
[commerce-product:field-product-node] [commerce-product:field_color]
Comment #7
martin74 CreditAttribution: martin74 commentedAny way to turn off or remove the translation strings from the module
So i dont get these messages anymore
Notice: Undefined index: nl in auto_entitylabel_set_title() (regel 246 van /var/www/vhosts/xxx/httpdocs/sites/all/modules/auto_entitylabel/auto_entitylabel.module).
Notice: Undefined index: en in auto_entitylabel_set_title() (regel 246 van /var/www/vhosts/xxx/httpdocs/sites/all/modules/auto_entitylabel/auto_entitylabel.module).
Comment #8
bforchhammer CreditAttribution: bforchhammer commented@Martin_S: Let's move the problem into a new issue: #2002082: PHP Notices for additional languages
This one was about blank titles, which I still have no idea on how to reproduce... :)
Comment #9
HnLn CreditAttribution: HnLn commentedI have the same problem here. Titles are generated fine on creation, but after saving on edit, they change to %AutoEntityLabel%.
The entities are eck entities, and the forms are going through some form alters (but nothing to do with title).
What I found so far:
* on edit the title gets correctly set in field_attach_submit,
* by the time it enters field_attach_presave, the entity title is %AutoEntityLabel% and auto_entitylabel_applied is TRUE.
Comment #10
HnLn CreditAttribution: HnLn commentedThe problem in #9 is because in 'eck__entity__form_submit' all the properties are looped and set (including title), and thus the title is set back to '%AutoEntityLabel%', while auto_entitylabel_applied is still true (from field_attach_submit), so it doesn't get regenerated.
Locally I can fix this by setting auto_entitylabel_applied back to false in another hook, how this can be avoided in a more general way, I'm not sure. Maybe eck properties can be altered and title unset if autoentitylabel is active for the entity type, but don't know if it's possible.
Comment #11
dqdoften an overlooked problem: the wrong tokens. [field:source:field-new-title] for example is wrong, [field:field-new-title] or [field:field_new_title] could be right. Just an example. Tokens often are not ordered like the fields or most common use-cases and often the most wanted token is on the bottom of the huge list (depending on your system) and some other tokens before look like exactly what you think you need to replace. So make always sure you have choosen the right tokens, before you hit the head against innocent keyboards. :-)
Comment #12
Dhruv Panchal CreditAttribution: Dhruv Panchal commentedThis drupal function can help you :- drupal_page_is_cacheable(FALSE);