Révision da542b7b
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.module | ||
---|---|---|
97 | 97 |
$files = $form_state['files']; |
98 | 98 |
$url = 'media/browser'; |
99 | 99 |
$parameters = array('query' => array('render' => 'media-popup', 'fid' => array_keys($files))); |
100 |
// Pass in "render_multi_edit_form" as a parameter to signal to the |
|
101 |
// media_browser() function that we need to edit multiple files. |
|
102 |
$parameters['query']['render_multi_edit_form'] = TRUE; |
|
100 | 103 |
} |
101 | 104 |
|
102 | 105 |
// If $url is set, we had some sort of upload, so redirect the form. |
... | ... | |
105 | 108 |
} |
106 | 109 |
} |
107 | 110 |
|
111 |
/** |
|
112 |
* Implements hook_multiform_get_form_alter(). |
|
113 |
* |
|
114 |
* Alter the multiform that is used after uploading multiple files. |
|
115 |
*/ |
|
116 |
function media_bulk_upload_multiform_get_form_alter($form_state_save, &$redirect, $all_args) { |
|
117 |
|
|
118 |
// Was this form submitted while in the Media browser? |
|
119 |
if (isset($redirect['#media_browser']) && !empty($form_state_save['input'])) { |
|
120 |
|
|
121 |
// The $all_args should be an array of arrays, with the second element of |
|
122 |
// the inner array being the file. For details on this structure, see |
|
123 |
// the media_bulk_upload_file_page_edit_multiple() function. |
|
124 |
$fids = array(); |
|
125 |
foreach ($all_args as $arg) { |
|
126 |
if (count($arg) == 2) { |
|
127 |
$file = $arg[1]; |
|
128 |
$fids[] = $file->fid; |
|
129 |
} |
|
130 |
} |
|
131 |
|
|
132 |
// If we found something, instruct the Media browser to close and attach |
|
133 |
// the files to whatever they need to be attached to. |
|
134 |
if (!empty($fids)) { |
|
135 |
$url = 'media/browser'; |
|
136 |
$parameters = array('query' => array('render' => 'media-popup', 'fid' => $fids)); |
|
137 |
$redirect['redirect'] = array($url, $parameters); |
|
138 |
} |
|
139 |
} |
|
140 |
} |
|
141 |
|
|
108 | 142 |
/** |
109 | 143 |
* Return a URL for editing an files. |
110 | 144 |
* |
Formats disponibles : Unified diff
Weekly update of contrib modules