? filefield_paths-939956.patch Index: filefield_paths.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/filefield_paths/filefield_paths.module,v retrieving revision 1.19.2.39 diff -u -p -r1.19.2.39 filefield_paths.module --- filefield_paths.module 11 Oct 2010 04:21:40 -0000 1.19.2.39 +++ filefield_paths.module 13 Oct 2010 02:38:10 -0000 @@ -38,8 +38,8 @@ function filefield_paths_filefield_paths } /** - * Implements hook_theme(). - */ + * Implements hook_theme(). + */ function filefield_paths_theme() { return array( 'filefield_paths_token_help' => array( @@ -73,8 +73,8 @@ function theme_filefield_paths_token_hel /** * Implements hook_init(). - */ -function filefield_paths_init() { + */ +function filefield_paths_init() { foreach (module_list() as $module) { if (file_exists($file = drupal_get_path('module', 'filefield_paths') . '/modules/' . $module . '.inc')) { require_once $file; @@ -82,7 +82,7 @@ function filefield_paths_init() { } } -/** +/** * Implements hook_form_alter(). */ function filefield_paths_form_alter(&$form, $form_state, $form_id) { @@ -137,19 +137,19 @@ function filefield_paths_form_alter(&$fo } } - $field_data['form_path'][$name . '_cleanup'] = array( + $field_data['form_path'][$name . '_cleanup'] = array( '#type' => 'fieldset', '#title' => t('!title cleanup settings', array('!title' => $field['title'])), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => ($count - 1) * 3 + 1, '#attributes' => array( - 'class' => array($name . ' cleanup') + 'class' => array($name . ' cleanup') ) ); // Cleanup field with Pathauto module. - $field_data['form_path'][$name . '_cleanup'][$name . '_pathauto'] = array( + $field_data['form_path'][$name . '_cleanup'][$name . '_pathauto'] = array( '#type' => 'checkbox', '#title' => t('Cleanup using Pathauto') . '.', '#default_value' => isset($field['settings']['pathauto']) @@ -159,8 +159,8 @@ function filefield_paths_form_alter(&$fo '#description' => t('Cleanup !title using !url', array('!title' => $field['title'], '!url' => l(t('Pathauto settings'), 'admin/build/path/pathauto'))), ); if (!module_exists('pathauto')) { - $field_data['form_path'][$name . '_cleanup'][$name . '_pathauto']['#disabled'] = TRUE; - $field_data['form_path'][$name . '_cleanup'][$name . '_pathauto']['#default_value'] = 0; + $field_data['form_path'][$name . '_cleanup'][$name . '_pathauto']['#disabled'] = TRUE; + $field_data['form_path'][$name . '_cleanup'][$name . '_pathauto']['#default_value'] = 0; } // Convert field to lower case. @@ -531,7 +531,7 @@ function filefield_paths_filefield_paths else { $file['filename']['new'] = $file['field']['filename']; } - + // Process filepath $file['filepath']['old'] = $file['field']['filepath']; $file['filepath']['new'] = filefield_paths_process_string(file_directory_path() . '/' . $settings['filepath']['value'] . '/' . $file['filename']['new'], 'node', $node, $settings['filepath']); @@ -639,7 +639,7 @@ function filefield_paths_token_list($typ * Implements hook_token_values(). */ function filefield_paths_token_values($type, $object = NULL) { - if ($type == 'field') { + if ($type == 'field' && isset($object[0]['filename'])) { $item = pathinfo($object[0]['filename']); $tokens = array(); if (!module_exists('filefield')) {