Révision da542b7b
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/media/media.module | ||
---|---|---|
266 | 266 |
// Get the current element and count the number of files. |
267 | 267 |
$current_element = $form; |
268 | 268 |
foreach ($form_parents as $parent) { |
269 |
$current_element = $current_element[$parent]; |
|
269 |
if (isset($current_element[$parent])) { |
|
270 |
$current_element = $current_element[$parent]; |
|
271 |
} |
|
272 |
else { |
|
273 |
$current_element = NULL; |
|
274 |
break; |
|
275 |
} |
|
270 | 276 |
} |
271 | 277 |
$current_file_count = isset($current_element['#file_upload_delta']) ? $current_element['#file_upload_delta'] : 0; |
272 | 278 |
|
... | ... | |
346 | 352 |
if ($form['#field']['type'] == 'file' && $form['instance']['widget']['type']['#value'] == 'media_generic') { |
347 | 353 |
$form['instance']['settings']['file_extensions']['#title'] = t('Allowed file extensions for uploaded files'); |
348 | 354 |
$form['instance']['settings']['file_extensions']['#maxlength'] = 255; |
355 |
$form['instance']['settings']['file_extensions']['#description'] .= '<br />' . t('If empty, the file extensions list will be composed automatically using the allowed file types.'); |
|
356 |
$form['instance']['settings']['file_extensions']['#required'] = FALSE; |
|
349 | 357 |
} |
350 | 358 |
|
351 | 359 |
// On image fields using the media widget we remove the alt/title fields. |
... | ... | |
363 | 371 |
if ($form['instance']['widget']['type']['#value'] == 'media_generic' && isset($form['#field']['settings']['uri_scheme'])) { |
364 | 372 |
$form['#validate'][] = 'media_field_instance_validate'; |
365 | 373 |
} |
366 |
|
|
367 |
if ($form['#instance']['entity_type'] == 'file') { |
|
368 |
$form['instance']['settings']['wysiwyg_override'] = array( |
|
369 |
'#type' => 'checkbox', |
|
370 |
'#title' => t('Override in WYSIWYG'), |
|
371 |
'#description' => t('If checked, then this field may be overridden in the WYSIWYG editor.'), |
|
372 |
'#default_value' => isset($form['#instance']['settings']['wysiwyg_override']) ? $form['#instance']['settings']['wysiwyg_override'] : TRUE, |
|
373 |
); |
|
374 |
} |
|
375 | 374 |
} |
376 | 375 |
|
377 | 376 |
/** |
... | ... | |
1141 | 1140 |
); |
1142 | 1141 |
} |
1143 | 1142 |
|
1144 |
// Override the fields of the file when requested by the WYSIWYG. |
|
1145 |
if (isset($file->override) && isset($file->override['fields'])) { |
|
1146 |
$instance = field_info_instances('file', $file->type); |
|
1147 |
foreach ($file->override['fields'] as $field_name => $value) { |
|
1148 |
if (!isset($instance[$field_name]['settings']) || !isset($instance[$field_name]['settings']['wysiwyg_override']) || $instance[$field_name]['settings']['wysiwyg_override']) { |
|
1149 |
$file->{$field_name} = $value;} |
|
1150 |
} |
|
1151 |
} |
|
1152 |
|
|
1153 | 1143 |
// Alt and title are special. |
1154 | 1144 |
// @see file_entity_file_load |
1155 | 1145 |
$alt = variable_get('file_entity_alt', '[file:field_file_image_alt_text]'); |
Formats disponibles : Unified diff
Weekly update of contrib modules