Skip to content
Snippets Groups Projects
Commit eb96140d authored by Lachlan Ennis's avatar Lachlan Ennis
Browse files

Issue #2153201 by PieterDC, Dave Bagler, elachlan: Add Font Awesome and Glyphicon Support

parent b9789c18
No related branches found
No related tags found
No related merge requests found
......@@ -21,3 +21,8 @@ span.mailto {
padding: 0;
}
}
/* Put some whitespace between the link and its Font Awesome suffix. */
span.extlink i {
padding-left: 0.2em;
}
......@@ -34,6 +34,7 @@ function extlink_uninstall() {
variable_del('extlink_mailto_label');
variable_del('extlink_subdomains');
variable_del('extlink_target');
variable_del('extlink_use_font_awesome');
cache_clear_all('variables', 'cache');
}
......
......@@ -179,11 +179,19 @@
for (i = 0; i < length; i++) {
var $link = $($links_to_process[i]);
if ($link.css('display') === 'inline' || $link.css('display') === 'inline-block') {
if (class_name === Drupal.settings.extlink.mailtoClass) {
$link[icon_placement]('<span class="' + class_name + '" aria-label="' + Drupal.settings.extlink.mailtoLabel + '"></span>');
}
else {
$link[icon_placement]('<span class="' + class_name + '" aria-label="' + Drupal.settings.extlink.extLabel + '"></span>');
if (Drupal.settings.extlink.extUseFontAwesome) {
if (class_name === Drupal.settings.extlink.mailtoClass) {
$link[icon_placement]('<span class="fa-' + class_name + ' extlink"><i class="fa fa-envelope-o" title="' + Drupal.settings.extlink.mailtoLabel + '"></i></span>');
}else{
$link[icon_placement]('<span class="fa-' + class_name + ' extlink"><i class="fa fa-external-link" title="' + Drupal.settings.extlink.extLabel + '"></i></span>');
}
}else{
if (class_name === Drupal.settings.extlink.mailtoClass) {
$link[icon_placement]('<span class="' + class_name + '" aria-label="' + Drupal.settings.extlink.mailtoLabel + '"></span>');
}
else {
$link[icon_placement]('<span class="' + class_name + '" aria-label="' + Drupal.settings.extlink.extLabel + '"></span>');
}
}
}
}
......
......@@ -55,6 +55,7 @@ function extlink_page_build() {
'extAlertText' => variable_get('extlink_alert_text', 'This link will take you to an external web site. We are not responsible for their content.'),
'mailtoClass' => variable_get('extlink_mailto_class', 'mailto'),
'mailtoLabel' => check_plain(variable_get('extlink_mailto_label', t('(link sends e-mail)'))),
'extUseFontAwesome' => variable_get('extlink_use_font_awesome', FALSE),
),
), 'setting');
}
......@@ -105,6 +106,14 @@ function extlink_admin_settings() {
'#description' => t('If checked, images wrapped in an anchor tag will be treated as external links.'),
);
$form['extlink_use_font_awesome'] = array(
'#type' => 'checkbox',
'#title' => t('Use Font Awesome icons instead of images.'),
'#return_value' => TRUE,
'#default_value' => variable_get('extlink_use_font_awesome', FALSE),
'#description' => t('Add Font Awesome classes to the link as well as an i tag rather than images.'),
);
$form['extlink_icon_placement'] = array(
'#type' => 'checkbox',
'#title' => t('Add icon in front of any processed link'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment