You are here

function ws_facebook_like_data in Service links 6.2

Same name and namespace in other branches
  1. 7.2 services/widget_services.module \ws_facebook_like_data()

Callback function for Facebook Like.

1 string reference to 'ws_facebook_like_data'
widget_services_service_links in services/widget_services.module
Implementation of hook_service_links().

File

services/widget_services.module, line 126
Extends Service Links with dynamic buttons.

Code

function ws_facebook_like_data(&$service, $subst) {
  static $vars;
  if (!isset($vars)) {
    $vars['tags'] = array(
      'layout' => '<layout>',
      'show_faces' => '<show_faces>',
      'action' => '<action>',
      'colorscheme' => '<colorscheme>',
      'font' => '<font>',
      'width' => '<width>',
      'height' => '<height>',
      'locale' => '<locale>',
    );
    $vars['subst'] = array(
      'layout' => check_plain(variable_get('service_links_fl_layout', 'button_count')),
      'show_faces' => check_plain(variable_get('service_links_fl_show_faces', 'false')),
      'action' => check_plain(variable_get('service_links_fl_action', 'like')),
      'colorscheme' => check_plain(variable_get('service_links_fl_colorscheme', 'light')),
      'font' => check_plain(variable_get('service_links_fl_font', '')),
      'width' => (int) variable_get('service_links_fl_width', 100),
      'height' => (int) variable_get('service_links_fl_height', 21),
      'locale' => check_plain(variable_get('service_links_fl_locale', '')),
    );
    $fl_settings = array(
      'width' => $vars['subst']['width'],
      'height' => $vars['subst']['height'],
    );
    drupal_add_js(array(
      'ws_fl' => $fl_settings,
    ), 'setting');
  }
  $service['url'] = str_replace($vars['tags'], $vars['subst'], $service['url']);
}