You are here

function upload_filefield_paths_form_alter in File (Field) Paths 5

Same name and namespace in other branches
  1. 6 modules/upload.inc \upload_filefield_paths_form_alter()

Implementation of hook_filefield_paths_form_alter().

File

modules/upload.inc, line 11
Provides FileField Paths integration with the Upload module.

Code

function upload_filefield_paths_form_alter(&$form, &$ffp) {
  if (isset($form['#id']) && $form['#id'] == 'node-type-form') {
    $ffp['upload'] = array(
      'type' => $form['#node_type']->type,
      'form_path' => &$form['workflow']['ffp_upload'],
      'file_path_default' => '',
    );

    // Create path settings fieldset
    $ffp['upload']['form_path'] = array(
      '#type' => 'fieldset',
      '#title' => t('Upload Path settings'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#weight' => isset($form['workflow']['upload']['#weight']) ? $form['workflow']['upload']['#weight'] + 1 : 1,
    );
    $ffp['upload']['form_path']['file_path'] = array(
      '#type' => 'textfield',
      '#title' => t('File path'),
      '#description' => t('Optional subdirectory within the "%dir" directory where files will be stored. Do not include trailing slash.', array(
        '%dir' => variable_get('file_directory_path', 'files'),
      )),
      '#tree' => TRUE,
    );
  }
}