Hello, I was wondering if there's a way to make the icon display before the link, not after. I want it to appear more like a bullet. I tried messing with the css file and it didn't work :/

LOVE THIS MODULE, tia

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lahode’s picture

Just change in extlink.js $(this).after by $(this).before everywhere

Something nicer would be to include the option in extlink_admin_settings, like:

  $form['extlink_place'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add icon next to external links'),
    '#return_value' => 'next',
    '#default_value' => variable_get('extlink_place', 'next'),
    '#description' => t('If checked the icon will placed next to external links.'),
  );

Then add line 24 after drupal_add_js(array('extlink' => array( :

    'extPlace'     => variable_get('extlink_place', 0),

And in your extlink.js file, change the line:

  if (Drupal.settings.extlink.extClass) {
    // Apply the "ext" class to all links not containing images.
    if (parseFloat($().jquery) < 1.2) {
      $(external_links).not('[img]').addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>'); });
    }
    else {
      $(external_links).not($(external_links).find('img').parents('a')).addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>'); });
    }
  }

  if (Drupal.settings.extlink.mailtoClass) {
    // Apply the "mailto" class to all mailto links not containing images.
    if (parseFloat($().jquery) < 1.2) {
      $(mailto_links).not('[img]').addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>'); });
    }
    else {
      $(mailto_links).not($(mailto_links).find('img').parents('a')).addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>'); });
    }
  }

by:

  if (Drupal.settings.extlink.extClass) {
    // Apply the "ext" class to all links not containing images.
    if (parseFloat($().jquery) < 1.2) {
      $(external_links).not('[img]').addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') {
          if (Drupal.settings.extlink.extPlace) {
            $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>');
          } else {
            $(this).before('<span class=' + Drupal.settings.extlink.extClass + '></span>');
          }
        }
      });
    }
    else {
      $(external_links).not($(external_links).find('img').parents('a')).addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') {
          if (Drupal.settings.extlink.extPlace) {
            $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>');
          } else {
            $(this).before('<span class=' + Drupal.settings.extlink.extClass + '></span>');
          }
        }
      });
    }
  }

  if (Drupal.settings.extlink.mailtoClass) {
    // Apply the "mailto" class to all mailto links not containing images.
    if (parseFloat($().jquery) < 1.2) {
      $(mailto_links).not('[img]').addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') {
          if (Drupal.settings.extlink.extPlace) {
            $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>');
          } else {
            $(this).before('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>');
          }
        }
      });
    }
    else {
      $(mailto_links).not($(mailto_links).find('img').parents('a')).addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') {
          if (Drupal.settings.extlink.extPlace) {
            $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>');
          } else {
            $(this).before('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>');
          }
        }
      });
    }
  }

Cheers

elachlan’s picture

Category: support » feature
Status: Active » Postponed

Could be a possible inclusion. Submit a patch and we will see about including it.

DrColossos’s picture

Version: 7.x-1.12 » 7.x-1.x-dev
Status: Postponed » Needs review
FileSize
2.39 KB

Since we needed this functionallity, I created a patch from the above. I slightly changed some of the wordings and changed the way the JavaScript is handled. Created against the latest dev

DrColossos’s picture

Issue summary: View changes

This patch has been around for quite some time, also with the refactored Javascript. We would love to have this feature available without patching the module. Please check the patch and let me know if anything needs changing.

elachlan’s picture

Status: Needs review » Needs work

Could you re-roll it to the latest version?

Also I may need to get the OK from quicksketch before a release, but we should be able to include it in dev for now.

DrColossos’s picture

Status: Needs work » Needs review
FileSize
3.91 KB

So, i finally managed to update the little patch. It's against the latest 7.x-1.x branch. I also rephrased some of the old wordings from my last patch.

  • DrColossos authored 82a9d4f on 7.x-1.x
    Fixes #1672650
    
    Signed-off-by: Lachlan Ennis <lachlan@expert1.com.au>
    
elachlan’s picture

I have pushed the change through.

Thanks you!

DamienMcKenna’s picture

Status: Needs review » Needs work

Needs an update to hook_uninstall() to remove the new variable.

osopolar’s picture

Status: Needs work » Fixed

This works for me. As this was already fixed in the dev version I created a new issue for #9: #2508509: Delete only variables set by extlink on uninstall.

Status: Fixed » Closed (fixed)

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

elachlan’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Status: Closed (fixed) » Patch (to be ported)
elachlan’s picture

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

Status: Needs review » Needs work

The last submitted patch, 13: IconPlacement-1672650-13.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
5.93 KB

Status: Needs review » Needs work

The last submitted patch, 15: IconPlacement-1672650-15.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
5.94 KB

  • elachlan committed dbd171a on 8.x-1.x
    Issue #1672650 by elachlan, DrColossos: placing icon BEFORE link, not...
elachlan’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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