You are here

function media_browser_plus_form_file_entity_add_upload_multiple_alter in Media Browser Plus 7.3

Same name and namespace in other branches
  1. 7.2 media_browser_plus.module \media_browser_plus_form_file_entity_add_upload_multiple_alter()

Implements hook_form_FORM_ID_alter().

File

./media_browser_plus.module, line 820
Media Browser Plus - enhanced file management functions.

Code

function media_browser_plus_form_file_entity_add_upload_multiple_alter(&$form, &$form_state) {

  // Abuse the taxonomy term field widget to get the available options.
  $field['settings']['allowed_values'][] = array(
    'vocabulary' => 'media_folders',
    'parent' => 0,
  );
  $form['field_folder'] = array(
    '#type' => 'select',
    '#title' => t('Folder'),
    '#description' => t('Defines the folder where the uploaded files will be saved'),
    '#options' => taxonomy_allowed_values($field),
  );

  // Add own submit handler to set the selected folder in the file objects.
  $form['#submit'][] = 'media_browser_plus_form_file_entity_add_upload_multiple_submit';
}