You are here

function template_preprocess_web_widgets_iframe in Web Widgets 7

Same name and namespace in other branches
  1. 6 iframe/web_widgets_style_iframe.inc \template_preprocess_web_widgets_iframe()

Process variables for web_widgets_iframe.tpl.php

File

iframe/web_widgets_style_iframe.inc, line 43
Iframe-specific functions, preprocessing

Code

function template_preprocess_web_widgets_iframe(&$variables) {
  $variables['wid'] = 'web_widget_iframe_' . md5(microtime());

  // Create Javascript variables
  $widgetcontext = new stdClass();
  if (empty($variables['width'])) {
    $variables['width'] = 200;
  }
  if (empty($variables['height'])) {
    $variables['height'] = 200;
  }
  $widgetcontext->url = $variables['path'] . '?width=' . $variables['width'] . '&height=' . $variables['height'];
  $widgetcontext->width = $variables['width'];
  $widgetcontext->height = $variables['height'];
  $widgetcontext->widgetid = $variables['wid'];
  $widgetcontext->scrolling = isset($variables['scrolling']) ? $variables['scrolling'] : 'auto';
  $variables['js_variables'] = drupal_json_encode($widgetcontext);
  $variables['script_url'] = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'web_widgets') . '/iframe/web_widgets_iframe.js';
}