I thought of this after reviewing your module, and I think this would be a useful addition to it.

To make a themer's life a little easier, what if there was the option to output the favicon in a custom CSS class?

Comments

2pha’s picture

Version: » 7.x-1.0
Status: Active » Closed (works as designed)

It's about time I got around to answering this now the module is a full project.
I don't like the idea of adding classes via the interface. I think that classes and custom markup belongs in the theme layer.
If it is really needed, the theme_link_favicon_formatter_favicon($vars) can be overridden.

If there were many requests for this though, I would probably reconsider.

Homotechsual’s picture

I think a class should at least be added by default if you're not going to provide an option to set one (which I understand entirely).

A default class will make this targetable by themers at least.

Homotechsual’s picture

On the subject of thumbing as a brief note:

To get the image to align correctly with the text set vertical-align to text-bottom.

2pha’s picture

The field that the favicon is attached to already has a class name. to target the favicon image you just need to add "img" to the selector. eg "field-name-my-field img". I see no need to add more markup/classes.
If you really want your own class, just override the theme function.

Homotechsual’s picture

Care to post a how-to for the theme function override so that people don't end up continually asking the question on the issue queues, if not I'll dig into the code and post a how to.?

I appreciate not wanting to add code bloat but I suspect this will be very useful for scenarios where fields contain multiple images (including the favicon) which need to be styled differently/separately.

Admittedly those are likely to be marginal use cases. I'm just looking at displaying preview screenshots for a link and having the favicon overlayed on top.

2pha’s picture

yeh...good idea...I'll add it to the project page when I get a chance.

Prancz_Adam’s picture

Nice fature! I like it. A css class would be great to padding the favicon. Thanks!

lolandese’s picture

Title: Add the ability for a custom CSS class » Make the favicon targetable with CSS
Version: 7.x-1.0 » 7.x-1.x-dev
Issue summary: View changes
Status: Closed (works as designed) » Needs review
StatusFileSize
new1.18 KB

Attached patch adds the class link-favicon to the image. This way it can be targeted with custom CSS, for example:

img.link-favicon {
  margin-right: 5px;
  vertical-align: middle;
}

  • 2pha committed f7ae28d on 7.x-1.x authored by lolandese
    Issue #1838262 by lolandese: Make the favicon targetable with CSS
    
2pha’s picture

Status: Needs review » Fixed
2pha’s picture

Status: Fixed » Closed (fixed)