Skip to content
Snippets Groups Projects
Commit 881bddd7 authored by Brian Osborne's avatar Brian Osborne
Browse files

Issue #3260273 by Anybody: Clarify description & error message about file extension limitation

parent 0c89f730
No related branches found
No related tags found
No related merge requests found
......@@ -114,9 +114,12 @@ function media_entity_file_replace_form_media_form_alter(&$form, FormStateInterf
];
$form['replace_file']['replacement_file']['#description'] = \Drupal::service('renderer')->renderPlain($helpText);
// Inform the user that when replacing the original file, the new one
// must have the same extension.
$originalExtension = '.' . pathinfo($fileFieldItem->entity->getFilename(), PATHINFO_EXTENSION);
$form['replace_file']['keep_original_filename'] = [
'#title' => t('Overwrite original file'),
'#description' => t('When checked, the original filename is kept and its contents are replaced with the new file. If unchecked, the filename of the replacement file will be used, and the original file may be deleted if no previous revision references it (depending on your specific site configuration).'),
'#title' => t('Overwrite original file (@originalExtension)', ['@originalExtension' => $originalExtension]),
'#description' => t('When checked, the original filename is kept and its contents are replaced with the new file, which <strong>must have the same file extension: @originalExtension</strong>. If unchecked, the filename of the replacement file will be used with any allowed file type and the original file may be deleted if no previous revision references it (depending on your specific site configuration).', ['@originalExtension' => $originalExtension]),
'#type' => 'checkbox',
'#default_value' => TRUE,
];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment