revision 1.1.2.28 made a change to the filefield_paths_get_fields function that assumes the module is being used only when submitting forms.

The code change is breaking programmatic file field creation, for example using imagecache programmatically to scale/crop images as used here: http://happypixels.net/blog/triggering-creation-imagecache-derivatives-p...

Is there a reason why the filefield_filefield_paths_get_fields function in modules/filefield.inc checks that a form_id is set on the $node param?

if (is_object($node) && $node->form_id == $node->type .'_node_form')

Couldn't the if stmt simply say:

if (is_object($node))

The previous implementation didn't check that a form_id was present and matched the content type name, but simply started iterating through the content type fields.

CommentFileSizeAuthor
#3 filefield_paths.zip32.04 KBDeciphered
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Deciphered’s picture

My apologies, I am aware of this issue as it breaks File Aliases.

Unfortunately the reason it was done that way was so that certain module compatibility wouldn't get mixed up, like Upload module files being identified as Comment Upload module files.

I will have a fix for this issue as soon as humanly possible.

Out of curiosity, did you run into this issue with File Aliases, or have you built another module that integrates with FileField Paths? Would be very interested in hearing how you are using FileField Paths.

Cheers,
Deciphered.

pixelantegroup’s picture

I have a custom module that is creating an imagefield using ImageCache programmatically the way described on the link in my first comment. The imagefield field on my content type is using filefield paths to tokenize the filepath.

Deciphered’s picture

FileSize
32.04 KB

Hi pixelantegroup,

I've attached the latest internal dev version for you to test out. Haven't looked at it since I got side-tracked working on a new module, but I had been testing it and I'm pretty sure I had fixed the main issue without and weeded out some of the other issues that the main issue was introduced to prevent.

I wouldn't specifically suggest deploying it on a production site, but testing would be appreciated and help speed up the process for the 1.4 bug fix release.

Cheers,
Deciphered.

pixelantegroup’s picture

I'll give it a go either later today or tomorrow and let you know how it goes. Thanks a lot!

Deciphered’s picture

Status: Active » Fixed

Fix committed to DRUPAL-6--1 and DRUPAL-5.

Cheers,
Deciphered.

Deciphered’s picture

Status: Fixed » Closed (fixed)