You are here

function _fblikebutton_field in Facebook Like Button 6

Same name and namespace in other branches
  1. 6.2 fblikebutton.module \_fblikebutton_field()
  2. 7.2 fblikebutton.module \_fblikebutton_field()
  3. 7 fblikebutton.module \_fblikebutton_field()
1 call to _fblikebutton_field()
fblikebutton_block in ./fblikebutton.module
Implementation of hook_block().

File

./fblikebutton.module, line 214
Adds Facebook's "Like" button to each selected node type. Adds a block with a global static value where users can "Like" the URL set by admins.

Code

function _fblikebutton_field($addr, $conf) {
  $addr = urlencode($addr);
  $width = "100%";
  $layout = $conf['layout'];
  $action = $conf['action'];
  $colorscheme = $conf['color_scheme'];
  $show_faces = $conf['show_faces'];
  $font = $conf['font'];
  $lang = $conf['language'];
  switch ($layout) {
    case "box_count":
      $height = 65;
    case "button_count":
      $height = 21;
    case "standard":
    default:
      $height = $show_faces == "false" ? 35 : 80;
  }
  $height = 60;
  $params = "href={$addr}&layout={$layout}&show_faces=false&width&font={$font}&height={$height}&action={$action}&colorscheme={$colorscheme}&locale={$lang}";
  $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}; height: {$height}px;\" allowTransparency=\"true\"></iframe>";
  return $output;
}