You are here

function jquery_ui_get_path in jQuery UI 6

Returns the path to the jQuery UI library or FALSE if not found.

2 calls to jquery_ui_get_path()
jquery_ui_add in ./jquery_ui.module
Add the specified jQuery UI library files to this page.
jquery_ui_get_version in ./jquery_ui.module
Return the version of jQuery UI installed.

File

./jquery_ui.module, line 78
Provides the jQuery UI plug-in to other Drupal modules.

Code

function jquery_ui_get_path() {
  static $path;
  if (isset($path)) {
    return $path;
  }
  $path = FALSE;

  // Libraries API integration.
  if (function_exists('libraries_get_path')) {
    $path = libraries_get_path('jquery.ui');

    // Libraries API 1.x returns a default path; 2.x returns FALSE.
    if ($path !== FALSE && !file_exists($path)) {
      $path = FALSE;
    }
  }
  elseif (file_exists('./sites/all/libraries/jquery.ui')) {
    $path = 'sites/all/libraries/jquery.ui';
  }

  // Check the module directory for backwards compatibility if other methods
  // failed.
  if (!$path) {

    // drupal_get_path() is not available during Drupal installation.
    if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install') {
      $path = drupal_substr(dirname(__FILE__), drupal_strlen(getcwd()) + 1);
      $path = strtr($path, '\\', '/');
      $path .= '/jquery.ui';
    }
    else {
      $path = drupal_get_path('module', 'jquery_ui') . '/jquery.ui';
    }
    if (!file_exists($path)) {
      $path = FALSE;
    }
  }
  return $path;
}