You are here

function select2_get_plugin_path in Select 2 7

Return the path to the Select2 plugin.

1 call to select2_get_plugin_path()
_select2_post_load_library_callback in ./select2.module
Sets the 'post-load callback' key.

File

./select2.module, line 642
Main file for Select2 module.

Code

function select2_get_plugin_path() {
  static $library_path = NULL;

  // Try to locate the library path in any possible setup.
  if ($library_path == NULL) {

    // First check the default location.
    $path = variable_get('select2_plugin_path', SELECT2_PLUGIN_PATH);
    if (is_dir($path)) {
      $library_path = $path;
    }
    elseif ($library_path == NULL && module_exists('libraries')) {
      if ($path = libraries_get_path('select2')) {
        $library_path = $path;
        variable_set('select2_plugin_path', $library_path);
      }
    }
    elseif ($library_path == NULL) {
      $library_path = SELECT2_PLUGIN_PATH;
    }
  }
  return $library_path;
}