You are here

function fb_social_preprocess_fb_social_plugin in Facebook social plugins integration 6.2

Same name and namespace in other branches
  1. 7.2 fb_social.module \fb_social_preprocess_fb_social_plugin()

Implements hook preprocess_hook

Parameters

$variables:

File

./fb_social.module, line 107

Code

function fb_social_preprocess_fb_social_plugin(&$variables) {
  global $_fb_script_init;
  $_fb_script_init = TRUE;
  $plugin = fb_social_fb_plugin_load($variables['plugin_type']);

  // delegate to plugin's preprocess function
  $function = ctools_plugin_get_function($plugin, 'hook_preprocess_fb_social_plugin');
  if ($function) {
    $function($variables);
  }

  // are we rendering html5 or xfbml
  $markup_type = variable_get('fb_social_markup_type', 'xfbml');
  $variables['tag_name'] = $markup_type == "xfbml" ? "fb:" . $plugin['html tag name'] : "div";
  if ($markup_type == 'html5') {
    foreach ($variables['options'] as $key => $value) {
      $variables['options']["data-" . $key] = $value;
      unset($variables['options'][$key]);
    }
    $variables['options'] = array(
      'class' => "fb-" . $plugin['html tag name'],
    ) + $variables['options'];
  }
}