Commit 8bbdfdb9 authored by git's avatar git Committed by joseph.olstad

Issue #2714581 by brockfanning, LittleRedHen: Remove references to link_text...

Issue #2714581 by brockfanning, LittleRedHen: Remove references to link_text or make its effect optional
parent bac2056a
......@@ -206,7 +206,7 @@ function media_wysiwyg_token_to_markup($match, $wysiwyg = FALSE, $langcode = NUL
// the rest of this function, so that if the file is themed as a link, the
// desired text will be used (see, for example, theme_file_link()).
// @todo: Try to find a less hacky way to do this.
if (isset($tag_info['link_text'])) {
if (isset($tag_info['link_text']) && variable_get('media_wysiwyg_use_link_text_for_filename', 1)) {
// The link text will have characters such as "&" encoded for HTML, but the
// filename itself needs the raw value when it is used to build the link,
// in order to avoid double encoding.
......@@ -236,7 +236,7 @@ function media_wysiwyg_token_to_markup($match, $wysiwyg = FALSE, $langcode = NUL
'view_mode' => $tag_info['view_mode'],
'link_text' => $tag_info['link_text'],
);
drupal_add_js(array('mediaDataMap' => array($file->fid => $data)), 'setting');
drupal_add_js(array('mediaDataMap' => array($file->fid => $data), 'mediaDoLinkText' => (boolean)(variable_get('media_wysiwyg_use_link_text_for_filename', 1))), 'setting');
$element['#attributes']['data-fid'] = $file->fid;
$element['#attributes']['data-media-element'] = '1';
$element['#attributes']['class'][] = 'media-element';
......
......@@ -345,7 +345,7 @@
});
// Extract the link text, if there is any.
file_info.link_text = element.find('a').html();
file_info.link_text = (Drupal.settings.mediaDoLinkText) ? element.find('a').html() : false;
// When a file is embedded, its fields can be overridden. To allow for
// the edge case where the same file is embedded multiple times with
......
......@@ -71,6 +71,7 @@ function media_wysiwyg_uninstall() {
variable_del('media_wysiwyg_wysiwyg_allowed_attributes');
variable_del('media_wysiwyg_wysiwyg_browser_plugins');
variable_del('media_wysiwyg_wysiwyg_override_field_types');
variable_del('media_wysiwyg_use_link_text_for_filename');
}
/**
......
......@@ -271,6 +271,13 @@ function media_wysiwyg_form_media_admin_config_browser_alter(&$form, &$form_stat
'#description' => t('If checked, then the field type may be overridden in the WYSIWYG editor. Not all field types (e.g. Term reference) currently support being overridden so the desired result might not be achieved.')
);
$form['wysiwyg']['media_wysiwyg_use_link_text_for_filename'] = array(
'#type' => 'checkbox',
'#title' => t("Use link text for filename"),
'#default_value' => variable_get('media_wysiwyg_use_link_text_for_filename', 1),
'#description' => t('When formatting inserted media, allow editable link text to be used in place of the filename. Turn this off if your file view modes handle link formatting.'),
);
$form['#submit'][] = 'media_wysiwyg_admin_config_browser_pre_submit';
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment