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.
(Moved here from http://drupal.org/node/1445124)
Current dev version doesn't correctly display tokenized title when entity is previewed rather than saved. Instead it displays "%AutoEntityLabel%" for the title.
Steps to reproduce on clean install of Drupal 7:
1. Install and enable auto_entitylabel, entity, token
2. Create a new content type with text field "field1"
3. Set "node auto label" to "Automatically generate the label and hide the label field" and in "Pattern for the title" put: [node:field_field1]
4. Create new content of that content type and preview. See attached png.
Comment | File | Size | Author |
---|---|---|---|
Untitled-1.png | 48.54 KB | rclemings |
Comments
Comment #1
bforchhammer CreditAttribution: bforchhammer commentedAs far as I can see this is quite hard to solve, because there's no good hook which we can use to override the data used for node previews; the ones I tested with in the past all had incomplete node objects, which means that tokens cannot be constructed properly and the title just ends up being empty (or rather the pattern string with empty placeholders).
If anyone can figure out a good way to this I'll be more than happy to add it to the module! I'm also reclassifying this as a feature request, as this is more or less by-design at the moment.
Comment #2
tinker CreditAttribution: tinker commentedWhat about using:
I could not find a good entity hook but this problem seems to be focused on nodes. AFAIK entity functions are not called for nodes until the node is saved so cannot be used in the preview stage.
One caveat: this will probably mess up the NID token. Since NID does not exist in preview stage it will not replace it with the correct value. Later calls to auto_entitylabel_is_needed() will return FALSE so when NID is available it will not be updated.
Comment #3
purushotam.rai CreditAttribution: purushotam.rai at QED42 commentedIssue no more persists, probably fixed with latest code releases.
Thanks a lot for all your inputs. Marking this issue as fixed, feel free to re-open if issue still persists.
Comment #4
purushotam.rai CreditAttribution: purushotam.rai at QED42 commented