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.
After installation of 1.5 version of Serial Field, I have the following problem :
All nodes with automatic nodetitle that use a serial field token are not filled in when the node is created. I have to go to content administration page, and to force an update of the node title, and the node title is then set correctly.
I have installed back version 1.4, and the problem disappears.
Comments
Comment #2
fredo38fr CreditAttribution: fredo38fr as a volunteer commentedComment #3
roald CreditAttribution: roald commentedI have 1.4, but have then the problem that the serial disappears from the node title when updating and saving the node.
Do you have the same problem, @fredo38fr ?
Comment #4
roald CreditAttribution: roald commentedI'm sorry - not my intention to confuse. My problem turned out to be permissions-related.
Any news on 1.5 serial not filling in automatic nodetitle?
Comment #5
Dr.D CreditAttribution: Dr.D as a volunteer commentedauto_nodetitle evaluates the constant AUTO_NODETITLE_OPTIONAL in the function auto_nodetitle_is_needed which is being called by the newer version of serial in the presave function.
previously, serial was calling using auto_nodetitle_get_settings
there was/is still a constant being used, but as the default return option, it still means "no go"
changing the presave function back fixes it for me.
function serial_node_presave($node) {
if (module_exists('auto_nodetitle') {
auto_nodetitle_get_setting($node->type)
Comment #6
BR0kENYou should configure your content type properly to set titles for nodes automatically (
admin/structure/types/manage/<TYPE>
).Comment #7
fredo38fr CreditAttribution: fredo38fr as a volunteer commentedI give some news about my problem (sorry for the delay).
So first, to answer to @br0ken, I have well configured my content type with following value :
'Automatically generate the title and hide the title field' (constant AUTO_NODETITLE_ENABLED in auto_nodetitle.module).
Second, I am in the same situation as @dr.d : If I update to Serial 1.5, the title is not updated correctly. If I go back to Serial 1.4 for function serial_node_presave, it works.
I have to be more precise for my problem : the title is generated by auto_nodetitle, but with the token that uses a serial value not evaluated.
I have put trace to debug in function auto_nodetitle_set_title and I have the following :
1- With Serial 1.4
auto_nodetitle_set_title is called twice. First time, title is set to the value I have configured in my content type, but with the token not evaluated (Example : Info_[node:field_id_article] ).
Second time, title is set correctly with the final value with token evaluated (Example : Info_24 ).
2- With Serial 1.5
auto_nodetitle_set_title is only called once (because the function auto_nodetitle_is_needed returns FALSE), and
the value for title is not correct, with the token not evaluated (Example : Info_[node:field_id_article] ). The only way to have the correct title, is to go to content admin, and to run 'Update automatic nodetitles'.
I have done a test too with a title that uses another token (date token for example), and with Serial 1.5, and the title is correctly set to the good value with the token evaluated on the first call of auto_nodetitle_set_title.
I am a french Drupal beginner, so it's hard for me to figure out where the problem is : Serial module, Auto_Nodetitle module, Token module ?
But the fact is that the modification done in serial_node_presave from version 1.4 to 1.5 has made the problem appear on my site.
Anyone can help ?
Comment #8
BR0kENThis is an issue of
auto_nodetitle
module (http://cgit.drupalcode.org/auto_nodetitle/tree/auto_nodetitle.module?h=7.x-1.0#n57).Serial module has the same code which will be removed (http://cgit.drupalcode.org/serial/tree/serial.module?id=4f73c53#n109). By that reason the
auto_nodetitle_set_title()
function invokes twice.Now about your and
Auto Node Title
problem.hook_node_presave()
calling before the node was saved and node object doesn't contain field values and tokens cannot be replaced.Comment #9
BR0kENYou could try with code snippet below:
Comment #10
markabur CreditAttribution: markabur commentedWhat worked for me was to switch from auto_nodetitle to https://www.drupal.org/project/auto_entitylabel instead.
See #2 and #3 here: #1672654: Automatic Nodetitles changes the default generated title when you edit a node
Comment #11
kopeboy CreditAttribution: kopeboy as a volunteer commentedI confirm it works perfect out of the box with auto_entitytlabel
Comment #12
roald CreditAttribution: roald commentedI can confirm auto_entitylabel works 99% with serial for the title. The message, noticing the node was created, omits the serial-number. Anyone else seeing that?