Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
When you programatically save a node, for example using views bulk operations, this module doesn't update it's value.
So I assume this module is doing it's work in the node form submission process?
Which would mean any other module/user that saves a node using node_save() will not trigger this module.
Comment | File | Size | Author |
---|---|---|---|
#6 | imagefield_tokens-fix_default_using_feeds-1187648-6.patch | 3.67 KB | fprevos2 |
#5 | imagefield_tokens-fix_default_using_feeds-1187648-5.patch | 3.19 KB | fprevos2 |
Comments
Comment #1
james.williams CreditAttribution: james.williams commentedProcessing is done in hook_filefield_paths_process_file(), which is invoked by filefield_paths on hook_node_update/insert() - which should be called during your node_save(). Maybe something else is going on?
Comment #2
Agileware CreditAttribution: Agileware commentedI had a bit of an investigate and it seems that the problem here is a filefield problem and is most likely intentional.
When you save using node_save it saves using the current field value but the default values don't get used.
It is only when you save the node at the node form that the default value takes affect.
It would be this way because when you just do node_save you have no way of knowing if the default value is to override the current value or not so it isn't safe to just override the value with the default.
Comment #3
james.williams CreditAttribution: james.williams commentedThe default values for a field (any CCK field, not just filefield) only ever get used in that node form - you could use drupal_execute() to load & submit a node form instead - which would work, but can get complicated. There's an example at http://civicactions.com/blog/cck_import_and_update, but you might want to read around that a bit to make sure you get it right.
Comment #4
Agileware CreditAttribution: Agileware commentedYeah it definitely makes sense, thanks.
Comment #5
fprevos2 CreditAttribution: fprevos2 commentedI use the Feeds module to import content that contains image. The feed source doesn't contains any alt text. I decide to default the alt text to the node title but since the default token didn't work I create this patch. I didn't look but I'm guessing that the Feeds module doesn't load the node form. The patch probably need work but it is a starting point for a proper patch.
Comment #6
fprevos2 CreditAttribution: fprevos2 commentedSmall update to the patch that should stop processing if the file field is empty.
Comment #7
yevhen CreditAttribution: yevhen commentedfprevos2, great! Your fix worked perfectly.
Comment #8
ysamoylenko CreditAttribution: ysamoylenko at EPAM Systems commentedHello everyone,
Support of Drupal 6 version of the module is stopped.
I recommend upgrading your website to the newer Drupal core version and use a new module version according to your Drupal core.
Anyway, thank you for your report and contribution.
Comment #9
ysamoylenko CreditAttribution: ysamoylenko at EPAM Systems commented