There are mainly two different ways to put the fb like button on a page:

  1. an iframe: currently used by this module, doesn't need any javascript
  2. a special element (HTML5 or XFBML): needs the fbconnect javascript, enables the use of javascript events

see https://developers.facebook.com/docs/reference/plugins/like/ .

While I don't think that this should become another module that inserts the fbconnect javascript (we can rely on the fbconnect module for that) it would still be nice to use the HTML5 version if the javascript is loaded anyway as it enables us to use advanced features like javascript events.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

torotil’s picture

Status: Active » Needs review
FileSize
3.58 KB

This patch puts another configuration option for the format on the settings page (which defaults to the "iframe" format) and rewrites _fblikebutton_field() to support the html5 format as well.

thomas.feichter’s picture

Version: 7.x-1.x-dev » 6.x-2.x-dev
FileSize
11.78 KB

I found this issue by accident and remembered that I have a related patch which I forgot to share.
Attached is a patch against the latest 6.x-2.x-dev adding support for HTML5 and XFBML implementations of the facebook like button.
It has been on a live site for about two weeks and seems to work fine.
Sorry for hijacking the Version...

Boletus’s picture

This would be a nice addition. The iframe version does not resize when the browser you are using isn't logged into Facebook and no faces is shown.

MrPeanut’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

Patch from #1 returns this error for me, using 7.x-2.0+10-dev (2012-Jul-08).

patch.patch:66: trailing whitespace.

patch.patch:75: trailing whitespace.

Checking patch fblikebutton.admin.inc...
error: while searching for:
    '#default_value' => variable_get('fblikebutton_language', 'en_US'),
    '#description' => t('Specific language to use. Default is English. Examples:<br/>French (France): <em>fr_FR</em><br/>French (Canada): <em>fr_CA</em>'),
  );
  return system_settings_form($form);
}


error: patch failed: fblikebutton.admin.inc:104
error: fblikebutton.admin.inc: patch does not apply
Checking patch fblikebutton.module...
error: while searching for:
}

function _fblikebutton_field($webpage_to_like, $conf) {
  $webpage_to_like = urlencode($webpage_to_like);
  $width = $conf['width'];
  $height = $conf['height'];
  $layout = $conf['layout'];
  $action = $conf['action'];
  $colorscheme = $conf['color_scheme'];
  $show_faces = $conf['show_faces'];
  $font = $conf['font'];
//  $send = $conf['send'];
  $other_css = $conf['other_css'];
  $language = $conf['language'];
  $params = "href={$webpage_to_like}&layout={$layout}&show_faces={$show_faces}&width={$width}px&font={$font}&height={$height}px&action={$action}&colorscheme={$colorscheme}&locale={$language}";
  $src = htmlentities($params);
  $output = '<iframe src="https://www.facebook.com/plugins/like.php?' . $src . '" scrolling="no" frameborder="0" style="border: none; overflow: hidden; width: ' . $width . 'px; height: ' . $height . 'px;' . $other_css . '" allowTransparency="true"></iframe>';
  return $output;
}

error: patch failed: fblikebutton.module:256
error: fblikebutton.module: patch does not apply
Kazanir’s picture

It is just failing because you're using a later dev than the one the patch was rolled against. I'll reroll and post when I get some time; although it seems like very few people are using those module compared to the more popular plugins mod.

torotil’s picture

FileSize
2.2 KB

Here is a re-roll against 7.x-2.3.