This is a systematic bug that I confirmed on a minimum stock install :
drupal 5.17 stock
cck-5.x-1.x-dev of 2009-mar-17
filefield-5;x-2.x-dev of 2009-mar-13
imagefield-5.x-2.6
mimedetect-5.x-1.x-dev of 2009-may-10
token-5.x-1.13
filefieldpath-5.x-1-dev of 2009-jul-10

Test:
1/ created "myimage" node type with a brand new "myimagefield" type.
2/ entered node/[type]/[nid] in myimagefield file path setting and submitted.
2a/ checked the DB, it is stored okay.
3/ went back to the myimagefield setting form : the "image path" setting does not show ;
however :
4/ created an myimage node which is correctly saved in node/myimage/1/xxx.jpg
5/ tested the same for "file name" attribute, which works perfect.
6/ tested from 1/ with an filefield field and it works fine.

What I checked :
I checked the code and I think I barely spotted the problem without being able to fix it so far.
filefield.inc does make a difference between filefield and imagefield because the latter uses an "image_path" attribute in widget setting form instead of "file_path" attribute for filefield widget setting form.
But in filefield_paths_form_alter (field_paths.module), the "image path" form for the Imagefield is not copied correctly to the $form to be displayed. I think the problem is line 114-115 :

// Set default value for patterns.
if (isset($field['settings']['value'])) {
$field_data['form_path'][$name]['#default_value'] = $field['settings']['value'];

where $name always has 'file_path' for "file_path/image_path" (set in filefield_paths_filefield_paths_field_settings) whereas the imagefield form is "image_path". So it is not copied in the right place and the filefield_paths module setting does not show.

I spotted this problem after making some updates on these modules. As I reproduced the bug on a stock install, I guess it is worth fixing it.

But I have not found any fix for this yet.

Eric

Comments

orico’s picture

I fixed the issue by editing

filefield_paths.module :
@function filefield_paths_form_alter
line 110
replacing :
$field_data['form_path']['#tree'] = TRUE;
$field_data['form_path'][$name]['#weight'] = ($count - 1) * 3;

// Set defualt value for patterns.
if (isset($field['settings']['value'])) {
$field_data['form_path'][$name]['#default_value'] = $field['settings']['value'];
by
$fname = (isset($field_data['form_path'][$name]) ? $name : 'image_path');

$field_data['form_path']['#tree'] = TRUE;
$field_data['form_path'][$fname]['#weight'] = ($count - 1) * 3;

// Set defualt value for patterns.
if (isset($field['settings']['value'])) {
$field_data['form_path'][$fname]['#default_value'] = $field['settings']['value'];

Sorry I can't create a clean patch file right now.

deciphered’s picture

Issue confirmed,

Fix will be committed shortly.

Cheers,
Deciphered.

deciphered’s picture

Status: Active » Fixed

Committed to DRUPAL-5 - http://drupal.org/cvs?commit=243164.

Dev build should be available shortly.

Cheers,
Deciphered.

deciphered’s picture

Status: Fixed » Closed (fixed)