Hello Mihai,

great idea for a social link field. Was about to write my own, when I found yours.

One thing though that I would like to remove is the dependency on Fontello fonts. There are so many font libraries out there and it's a unnecessary to load a font library just for the backend.
How about instead of rendering the Fontello icon on the edit form, you simply display the service name (e.g. Facebook, Twitter, etc.)?

If you are ok with this improvement, I can create a patch for you.

Thanks,
Johannes

Comments

jlyon’s picture

One way around this I'm using: Just update the 'socialfield_services' variable. This code adds support for Fontawesome, provided the FontAwesome CSS file is included. I'm doing it in a hook_install, but it could be done wherever.


/**
 * Implements hook_install().
 * Adds FontAwesome support to socialfield.
 */
function mymodule_install() {
  $base_services = variable_get('socialfield_services', array()); 

  foreach ($base_services as $key => &$data) {
    $data['icon'] .= ' fa fa-' . $key;
  }

  variable_set('socialfield_services', $base_services);
}

johannez’s picture

Hi Jeff,

thank you for the response and the code sample. My suggestion wasn't about replacing the Fontello (nothing wrong with it :) ) with Fontawesome.
I simply don't think it's a good idea to request any font library for the backend. I feel out of the box (without any library download), you should be able to use the field and just see text placeholders for the services. Once, you install a library, it'll be replaced by the proper icon.

I'll send you a patch with what I mean.

Happy Friday,
Johannes

k_zoltan’s picture

Title: Remove dependency on Fontello fonts » General font library support, a way to choose one of many (Fontello, Fontawesome ...)
Version: 7.x-1.4 » 7.x-1.x-dev

Hi @johannez thank for filing this issue.

We should try to find a general solution that supports multiple font libraries.

We are working on a tight schedule but if you provide a patch we will happily review and include in the project.

Mihai Husar’s picture

It can be done, but in my opinion it will be ugly to display only text instead of icons. You are not dependent on Fontello library. The module settings comes by default for the Fontello library, but this can be changed easily. That is why I built for this module a configuration page where you can change the icon class used for any service. For this go to admin/config/media/socialfield. So if you want to use other library than Fontello just simply change the icon classes for the services (assuming that the library you want to use is loaded on your site).

jenlampton’s picture

Category: Feature request » Support request
Status: Active » Fixed

If you want to use fontello, you can use the provided submodule.

If you don't want to use fontello, you can add your own classes via the UI at admin/config/media/socialfield, or by modifying the socialfield_services variable, as recommended in #1.

I'm going to close this issue, since I think the feature you are requesting already exists :)

Status: Fixed » Closed (fixed)

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