You are here

public function GoogleVisualizationAPIHandler::postRender in Visualization API 7

Loads the global Javascript required by the Google Visualization API.

Overrides VisualizationHandlerInterface::postRender

File

includes/plugins/google_visualization_api.inc, line 84
Library plugin for Visualization implementing support for Google Visualization API.

Class

GoogleVisualizationAPIHandler
@file Library plugin for Visualization implementing support for Google Visualization API.

Code

public function postRender() {
  if (!$this->addedJavascript) {
    drupal_add_js('https://www.google.com/jsapi', 'external');
    drupal_add_js('google.load("visualization", "1", {packages:["corechart", "geomap"]});', array(
      'type' => 'inline',
    ));
    drupal_add_js(drupal_get_path('module', 'visualization') . '/js/gva.js', array(
      'scope' => 'footer',
    ));
    $this->addedJavascript = TRUE;
  }
}