Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Bagler’s picture

Status: Active » Needs review
FileSize
2.86 KB

Here's a patch. It adds a checkbox to the settings form (Add font awesome classes instead of an image.) If the checkbox is checked, rather than displaying the image icon an tag is added with the appropriate font awesome classes. Less flexible than using the extras module and the icon API but a much simpler solution if you just want to replace those two images.

shortspoken’s picture

Awesome! Works as expected. Thanks a lot!

Dave Bagler’s picture

Assigned: Dave Bagler » Unassigned
nhck’s picture

Status: Needs review » Needs work
+++ b/extlink.module
@@ -113,6 +114,14 @@ function extlink_admin_settings() {
+  $form['extlink_usefa'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Add font awesome classes instead of an image.'),
+    '#return_value' => '_blank',
+    '#default_value' => variable_get('extlink_usefa', 0),
+    '#description' => t('Add font awesome classes to the link as well as an <i> tag rather than images.'),
+  );
+

Imho this option should check firtst whether the module fontawesome is enabled via module_exists('fontawesome')

Dave Bagler’s picture

Wouldn't that force people to use the font awesome module though? This just adds CSS classes so regardless of how font awesome is integrated the classes will be there.

Dave Bagler’s picture

Status: Needs work » Needs review
nhck’s picture

That is correct - I just thought it might be confusing.

On the other hand maybe we can add some other classes in the same manner - e.g. glyphicons and make it a more generic approach - what do you think?

Dave Bagler’s picture

Yeah I think adding glyphicons might be a benefit for some Devs. I'll make a separate (but related) issue for it so it can have a more accurate, descriptive title.

Dave Bagler’s picture

elachlan’s picture

Title: Add Font Awesome Support » Add Font Awesome and Glyphicon Support
Issue summary: View changes
Status: Needs review » Needs work
Related issues: -#2185461: Add Glyphicon Support

Merging the issues.

elachlan’s picture

Issue summary: View changes
duckydan’s picture

Hi,

Just in case anyone wants this, I added some CSS myself to do this. This is not the "right" way, but it is a CSS solution if you already use Glyphicons elsewhere.

span.ext, span.mailto {
display: none!important;
}

a.ext:after {
    position:relative;
    top:1px;
    display:inline-block;
    font-family:'Glyphicons Halflings';
    -webkit-font-smoothing:antialiased;
    font-style:normal;
    font-weight:normal;
    line-height:1;
    -moz-osx-font-smoothing:grayscale;
	content: " \e144";
	margin: 0 0 0 3px;
	padding: 0;
	color: gray;
}

a.mailto:after {
    position:relative;
    top:1px;
    display:inline-block;
    font-family:'Glyphicons Halflings';
    -webkit-font-smoothing:antialiased;
    font-style:normal;
    font-weight:normal;
    line-height:1;
    -moz-osx-font-smoothing:grayscale;
	content: " \2709";
	margin: 0 0 0 3px;
	padding: 0;
	color: gray;
}
elachlan’s picture

There are some conflicts, can you please re-roll the patch?

Edit: Also I realize that we don't have Glyphicon support in the patch. I think maybe we can just live with Font-Awesome for now.

PieterDC’s picture

Rerolled patch with Font Awesome support against Extlink 7.x-1.18
See attached.

  • Inversed the if-logic in the JavaScript file to improve readability
  • Added a 'extlink' CSS class to be able to provide default module CSS that visually cuts the Font Awesome icon suffix a bit loose from the link itself
  • Changed the new Drupal variable its name to be more in line with the already existing Extlink Drupal variable names
  • Moved the checkbox up on the admin form. Just below the 3 checkboxes that let you configure where to put the icon.

Didn't add Glyphicon support because I don't need it yet.

PieterDC’s picture

Component: Code » User interface
Status: Needs work » Needs review
FileSize
3.14 KB

Retry patch.

Status: Needs review » Needs work

The last submitted patch, 15: AddFontAwesomeSupport-2153201-15.patch, failed testing. View results

PieterDC’s picture

Status: Needs work » Needs review
FileSize
3.2 KB

Rerolled patch against dev branch because tests run on that branch.

Status: Needs review » Needs work

The last submitted patch, 17: AddFontAwesomeSupport-2153201-16.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.61 KB

I re-rolled the patch.

  • elachlan committed eb96140 on 7.x-1.x
    Issue #2153201 by PieterDC, Dave Bagler, elachlan: Add Font Awesome and...
elachlan’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Status: Needs review » Patch (to be ported)

7.x done needs 8.x

elachlan’s picture

Status: Patch (to be ported) » Needs review
FileSize
4.4 KB

Status: Needs review » Needs work

The last submitted patch, 22: AddFontAwesomeSupport-2153201-22.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.28 KB

Status: Needs review » Needs work

The last submitted patch, 24: AddFontAwesomeSupport-2153201-24.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.31 KB

Status: Needs review » Needs work

The last submitted patch, 26: AddFontAwesomeSupport-2153201-26.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.29 KB

Status: Needs review » Needs work

The last submitted patch, 28: AddFontAwesomeSupport-2153201-28.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
6.21 KB

Status: Needs review » Needs work

The last submitted patch, 30: AddFontAwesomeSupport-2153201-30.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
6.21 KB

  • elachlan committed a8d0b89 on 8.x-1.x
    Issue #2153201 by elachlan, PieterDC, Dave Bagler: Add Font Awesome and...
elachlan’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.