You are here

function comment_upload_filefield_paths_form_alter in File (Field) Paths 6

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

Implements hook_filefield_paths_form_alter().

File

modules/comment_upload.inc, line 10
Provides FileField Paths integration with the Comment Upload module.

Code

function comment_upload_filefield_paths_form_alter(&$form, &$ffp) {
  if (isset($form['#id']) && $form['#id'] == 'node-type-form') {
    $ffp['comment_upload'] = array(
      'type' => $form['#node_type']->type,
      'form_path' => &$form['comment']['ffp_comment_upload'],
      'file_path_default' => '',
    );

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