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.
Hi,
I have a content type with "Automatically generate the title and hide the title field" set. In the pattern field I put two fields separated with a whitespace : [node:field_arch_nom] [node:field_arch_firstname]
First field is mandatory, second field is not mandatory.
- If the second field is empty then I have a whitespace in the node title (ie: "First field ")
- With feeds module, when I import nodes (csv parser), an extra comma and a whitespace is added for each fields in the title (ie: "First field, second field, ").
For my feeds importer, I mapped the title with a column in my csv file.
If auto_nodetitle is not enabled on my content type, the title is correctly set when importing nodes, but when I enable it, the extra comma is added.
Any ideas ?
Thank you
Comments
Comment #1
marqpdx CreditAttribution: marqpdx commentedI'm getting the same.
i'm not sure if the bug is in this module or in the feeds module.
will keep looking, but any pointers are welcome.
thx
Comment #2
drupixMmhh... If I don't use automatic node title (set the option disabled on content type) then the import works normally, so I'm not sure but I think that the problem is here...
I've try to find the problem unsuccessfully, my investigation stopped in the function _auto_nodetitle_patternprocessor and auto_nodetitle_eval... In case it help
Thank you
Comment #3
marqpdx CreditAttribution: marqpdx commentedHi, here's a small update.
It's not just an extra comma, it's two chars, comma and space.
here is some sql i'm using as a post import cleanup, in case it helps:
UPDATE node
SET title = left(title, char_length(title)-2)
where right(title, 2 ) = ', '
thx,
m
Comment #4
drupixYou're right, there are two chars...
Finally I have implemented hook_node_presave() and removed the comma and the space like this :
That solved my problems
Comment #4.0
drupixbetter axplanation
Comment #5
manish-31 CreditAttribution: manish-31 at OpenSense Labs for DrupalFit commented