You are here

function chosen_get_chosen_path in Chosen 7.2

Same name and namespace in other branches
  1. 7.3 chosen.module \chosen_get_chosen_path()

Get the location of the chosen library.

Return value

mixed The location of the library, or FALSE if the library isn't installed.

4 calls to chosen_get_chosen_path()
chosen_admin_settings in ./chosen.admin.inc
Returns with the general configuration form.
chosen_form_field_ui_field_edit_form_alter in ./chosen.module
Implements hook_form_FORM_ID_alter().
chosen_library in ./chosen.module
Implements hook_library().
chosen_requirements in ./chosen.install
Implements hook_requirements().

File

./chosen.module, line 303
General functions and hook implementations.

Code

function chosen_get_chosen_path() {
  if (function_exists('libraries_get_path')) {
    return libraries_get_path('chosen');
  }

  // The following logic is taken from libraries_get_libraries()
  $searchdir = array();

  // Similar to 'modules' and 'themes' directories inside an installation
  // profile, installation profiles may want to place libraries into a
  // 'libraries' directory.
  $searchdir[] = 'profiles/' . drupal_get_profile() . '/libraries';

  // Always search sites/all/libraries.
  $searchdir[] = 'sites/all/libraries';

  // Also search sites/<domain>/*.
  $searchdir[] = conf_path() . '/libraries';
  foreach ($searchdir as $dir) {
    if (file_exists($dir . '/chosen/chosen.jquery.min.js')) {
      return $dir . '/chosen';
    }
  }
  return FALSE;
}