You are here

function audio_filefield_paths_form_alter in File (Field) Paths 6

Implements hook_filefield_paths_form_alter().

File

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

Code

function audio_filefield_paths_form_alter(&$form, &$ffp) {
  if (isset($form['#id']) && $form['#id'] == 'node-type-form' && isset($form['#node_type']) && $form['#node_type']->module == 'audio') {
    $ffp['audio'] = array(
      'type' => $form['#node_type']->type,
      'form_path' => &$form['ffp_audio'],
      'file_path_default' => '',
    );

    // Create path settings fieldset
    $ffp['audio']['form_path'] = array(
      '#type' => 'fieldset',
      '#title' => t('Audio Path settings'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $ffp['audio']['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,
    );
    $form['workflow']['#weight'] = $form['comment']['#weight'] = 1;
  }
}