You are here

function filefield_filefield_paths_form_alter in File (Field) Paths 6

Same name and namespace in other branches
  1. 5 modules/filefield.inc \filefield_filefield_paths_form_alter()

Implements hook_filefield_paths_form_alter().

File

modules/filefield.inc, line 10
Provides FileField Paths integration with the FileField module.

Code

function filefield_filefield_paths_form_alter(&$form, &$ffp) {
  if (isset($form['basic']['type']['#value']) && $form['basic']['type']['#value'] == 'filefield' && isset($form['widget']['path_settings'])) {
    $form['widget']['ffp_' . $form['field_name']['#value']] = $form['widget']['path_settings'];
    $form['widget']['path_settings']['#access'] = FALSE;
    $ffp[$form['field_name']['#value']] = array(
      'show' => TRUE,
      'type' => $form['type_name']['#value'],
      'form_path' => &$form['widget']['ffp_' . $form['field_name']['#value']],
      'file_path_default' => $form['widget']['path_settings']['file_path']['#default_value'],
    );
    $form['widget']['ffp_' . $form['field_name']['#value']]['#title'] = t('FileField Path settings');
    unset($ffp[$form['field_name']['#value']]['form_path']['file_path']['#suffix']);
    $ffp[$form['field_name']['#value']]['form_path']['#attributes'] = array(
      'id' => 'fieldset-path_settings',
    );
  }
}