https://drupal.org/sandbox/natts1/2287455

The Link Icons module is a field formatter for the Link field to display an icon for the service being linked to - ex. Facebook, Twitter or LinkedIn, with various display options available as settings of the formatter. The icons themselves are provided from the Font Awesome project.

Services/icons currently supported are:

  • behance.net
  • deviantart.com
  • digg.com
  • dribbble.com
  • dropbox.com
  • drupal.org
  • facebook.com
  • flickr.com
  • foursquare.com
  • github.com
  • google.com (G+)
  • instagram.com
  • joomla.org
  • jsfiddle.net
  • linkedin.com
  • pinterest.com
  • reddit.com
  • soundcloud.com
  • spotify.com
  • spotlight.com
  • stackexchange.com
  • stackoverflow.com
  • stumbleupon.com
  • tumblr.com
  • twitter.com
  • vimeo.com
  • vine.co
  • wordpress.com
  • wordpress.org
  • xing.com
  • yahoo.com
  • youtube.com

The generic globe icon is used if a link URL does not have one of the hostnames above.

Similar/related modules

The following modules may alternatively suit your needs:

  • Link icon - has many more features than this module, including Font Awesome support, but may overcomplicate things for you
  • Link favicon formatter - offers three methods to get the favicon for the site of the link, and then a formatting option

Requirements

The link field module, obviously, and the Font Awesome Icons module that adds the Font Awesome project to Drupal allowing the icons to be displayed.

Installation

Install as usual.

Configuration

Just head to a content type display management tab (ex. http://yoursite.com/admin/structure/types/manage/yourtype/display) where you have a link field/fields. In the format column for the link field that you want to use this formatter, select the 'Service icon (with options)' format and save the form to put it into use.

Click the settings cog/gear button to view and edit the (hopefully) self-explanatory options for how the links should be displayed. These exploit most of the Font Awesome features.

To customise the icons further, just theme your pages as usual. With the icons rendered as text characters using Font Awesome, you can style them with CSS as you wish.

Thanks

Thanks to Bobík (bobik) who published a sandbox project which was the starting point for this module.

The icons are from the Font Awesome project, by Greg Loucas and Dave Gandy.

The font has been made available to Drupal in the Font Awesome Icons module by Rob
Loach (RobLoach)
and Inder Singh (inders).

Git Clone Link

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/natts1/2287455.git

CommentFileSizeAuthor
#5 2287461-link_icons_ui_string.diff5.32 KBleewillis77

Comments

natts’s picture

Issue summary: View changes
PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxnatts12287455git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

natts’s picture

Issue summary: View changes
Status: Needs work » Needs review
natts’s picture

Issue summary: View changes
leewillis77’s picture

Status: Needs review » Needs work
StatusFileSize
new5.32 KB

Automated review

PAreview is clear as per previous comments.

Manual Review

Duplication

The project title seems to similar to the existing linkicon module: https://drupal.org/project/linkicon. While that module does something different, you should consider a name change to avoid future confusion between link_icons and linkicon.

README.txt

The README file is nice and clear, but doesn't follow the (Admittedly not very firm guidelines - https://drupal.org/node/447604. Consider following the styles set out in that link for headings and bullet points.

I installed the module, and gave it a try. I've attached a patch which makes some changes to the strings in the UI to make the capitalisation consistent with other fields on the "Manage display" screens.

natts’s picture

Status: Needs work » Needs review

Thanks for the review Lee. I have now updated the README to the newer template, and included your patches for UI consistency.

I admit I was unaware of the Linkicon module until now, but I would like to stick with 'Link Icons'/'link_icons' for the name/URL as they best describe what the module does (provides icons for links).

leewillis77’s picture

Thanks natts,

I'm going to leave as "Needs Review" as I'm not sure on the policy around potential naming conflicts - other than that I'd be happy to mark as RTBC - hopefully someone else will review either flip the switch - or clarify.

ruslan piskarov’s picture

Hello natts.

It seems to me that it
/**
* Field formatter for Link field.
*
* @file link_icons.module
*/
can be replaced to that
/**
* @file
* Field formatter for Link field.
*/

String 246:
The $inverse variable might have not neeb defined.

String 256:
"_blank" - Can you use single quotes?

String 287:
The $text variable might have not neeb defined too. If case is default.

Thanks.

tregismoreira’s picture

Manual review

link_icons.module file:

  • It's better to put endpoint in all translatable string.
  • It's a recommendation to use single quotes as default, except when your string have apostrophe. you have several translatable strings with double quotes.
  • Your code is without any documentation. How do you expect others to understand what you wanted to do?

Also, none of the items previous identified by Ruslan was resolved.

Good work! ;)

howto’s picture

Missing git clone command in your issue. Please provide a git clone command.

howto’s picture

Status: Needs review » Needs work

Manually review.

Line 43, 111, file link_icons.module, function link_icons_field_formatter_settings_form()

You should use property #empty_option, #empty_value to add empty option to select element.

Line 81, file link_icons.module function link_icons_field_formatter_settings_form().

Notice: Undefined index: fixed-width in link_icons_field_formatter_settings_form() (line 81 of .../sites/all/modules/contrib/link_icons/link_icons.module).
Setting name fixed-width is not defined in hook_field_formatter_info().

[Optional] Line 40, 54, file link_icons.module, function link_icons_field_formatter_settings_form()

String "if any" should have same style with the other. "if any" vs "(if any)"

natts’s picture

Issue summary: View changes
Status: Needs work » Needs review

Thanks for the comments Ruslan, Tregis and How to. I've now updated the .module file accordingly, and added the git clone command to the issue summary.

natts’s picture

Issue summary: View changes

Added spotlight.com service

partyka’s picture

Automated Review

This is from drush dcd
FILE: ...P/htdocs/drupal7/sites/all/modules/contrib/link_icons/link_icons.module
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
3 | ERROR | The second line in the file doc comment must be " * @file"
4 | ERROR | The third line in the file doc comment must contain a description
| | and must not be indented
--------------------------------------------------------------------------------

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Only as mentioned above.
Master Branch
Yes Follows the guidelines for master branch.
Licensing
Yes Follows the licensing requirements
3rd party code
Yes Follows the guidelines for 3rd party code. (That is, no third party code).
README.txt
README is fairly
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes/No. If "no", list security issues identified.
Coding style & Drupal API usage
Place code review here using this format:
  • Please consider more in-line documentation, especially in the hook_field_formatter_view() function - this will allow more readability.
miroslavbanov’s picture

Status: Needs review » Needs work

Hi natts,

Thanks for the contribution. This is a nice module that serves a very useful function.

I tested it. It works.

Automated review shows a few minor problems.

FILE: /var/www/drupal-7-pareview/pareview_temp/link_icons.module
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 4 LINES
--------------------------------------------------------------------------------
  3 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
  4 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
  5 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
 87 | WARNING | [ ] Avoid backslash escaping in translatable strings when
    |         |     possible, use "" quotes instead
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Review checklist is all checked.

No need to repeat the previous review. The only problem there is that link_icons_field_formatter_view() could use a few comments. But this is not such a major issue that should prevent the project from being promoted.

A suggestion

I would recommend having a way for other modules to add additional sites without hacking the module code. For instance, in link_icons_field_formatter_view() you could do:

  $services = module_invoke_all('link_icons_services');
  drupal_alter('link_icons_services', $services);

And you could return your services from implementing the same hook:

function link_icons_link_icons_services() {
  return array(
    'behance.net' => array('behance', 'black', 'behance-square'),
    // ...
  );
}

But this is a suggestion, and not a problem you must fix. The only blocking issue, in my opinion, is to fix the PAReview errors.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.

natts’s picture

Status: Closed (won't fix) » Needs review

Finally got around to fixing those small issues and updating the code as suggested.

miroslavbanov’s picture

Status: Needs review » Reviewed & tested by the community

I see that the corrections are made. I see a small problem that the function link_icons_link_icons_services doesn't have comment. I suggest to change it to:

/**
 * Implements hook_link_icons_services().
 */
function link_icons_link_icons_services() {

I think this is good enough to be promoted. It already had very minor issues previously, so I think this is overdue. Thanks again for the nice contribution and effort.

natts’s picture

Thanks Miroslav, I'll make that change shortly. Just waiting to get my Git status upgraded then :-) https://www.drupal.org/node/539608

natts’s picture

Priority: Normal » Major
ayesh’s picture

Assigned: Unassigned » ayesh

Hi Natts,
Sorry about the delay in reviewing your application. I'm assigning this to myself to take a final look and then I will go ahead with the application process :)

There are few modules that provide similar functionality. The most similar ones are:
- https://www.drupal.org/project/link_favicon_formatter
- https://www.drupal.org/project/linkicon

They have slightly different functionality, but linking to them and explaining the differences will make it easier for others.

natts’s picture

Issue summary: View changes

Thanks Ayesh - I have updated the description.

natts’s picture

Hi Ayesh - any news/progress?

cweagans’s picture

Assigned: ayesh » Unassigned
Status: Reviewed & tested by the community » Fixed

Thanks for your contribution!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

Status: Fixed » Closed (fixed)

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