You are here

public static function SiteimproveUtils::includeJs in Siteimprove 7

Include all Siteimprove js scripts.

Parameters

string $url: Url.

string $type: Action: recheck|input|recrawl|domain.

bool $auto: Automatic calling to the defined method.

1 call to SiteimproveUtils::includeJs()
siteimprove_init in ./siteimprove.module
Implements hook_init().

File

includes/SiteimproveUtils.php, line 57
Utils for Siteimprove Plugin.

Class

SiteimproveUtils
Class SiteimproveUtils.

Code

public static function includeJs($url, $type, $auto = TRUE) {

  // Add Siteimprove JS.
  drupal_add_js(self::JS_LIBRARY_URL, 'external');

  // Add url and token to the JS settings.
  drupal_add_js(array(
    'siteimprove' => array(
      $type => array(
        'auto' => $auto,
        'url' => SiteimproveUtils::rewriteDomain($url),
      ),
      'token' => variable_get('siteimprove_token'),
    ),
  ), 'setting');

  // Include custom JS.
  drupal_add_js(drupal_get_path('module', 'siteimprove') . '/js/siteimprove.js');
}