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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

james.williams’s picture

Processing 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?

Agileware’s picture

Status: Active » Closed (works as designed)

I 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.

james.williams’s picture

The 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.

Agileware’s picture

Yeah it definitely makes sense, thanks.

fprevos2’s picture

Issue summary: View changes
Status: Closed (works as designed) » Needs review
FileSize
3.19 KB

I 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.

fprevos2’s picture

Small update to the patch that should stop processing if the file field is empty.

yevhen’s picture

fprevos2, great! Your fix worked perfectly.

ysamoylenko’s picture

Hello 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.

ysamoylenko’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.