You are here

function media_browser_plus_folder_list_submit in Media Browser Plus 7

Same name and namespace in other branches
  1. 7.2 includes/media_browser_plus.folders.inc \media_browser_plus_folder_list_submit()

@todo Document what this function is does.

_state

Parameters

$form:

File

includes/media_browser_plus.folders.inc, line 68
Folder manipulation functions

Code

function media_browser_plus_folder_list_submit($form, &$form_state) {
  foreach ($form_state['input'] as $key => $value) {
    if (strstr($key, 'folder_id')) {
      $folder = media_browser_plus_folder_load((int) $value['folder_id']);
      $source = media_browser_plus_construct_dir_path($folder);
      $folder->parent = (int) $value['pid'];
      $folder->weight = (int) $value['weight'];
      taxonomy_term_save($folder);
      $destination = media_browser_plus_construct_dir_path($folder);
      if ($source != $destination) {

        // update physical folder structure
        media_browser_plus_move_physical_folder($source, $destination);
      }
    }
  }
  drupal_set_message(t('Changes saved successfully'));
  $form_state['redirect'] = 'admin/content/media/thumbnails';
}