You are here

function _less_libraries_determine_location in Less CSS Preprocessor 7.4

Same name and namespace in other branches
  1. 8 includes/less.libraries.inc \_less_libraries_determine_location()
  2. 7.3 less.libraries.inc \_less_libraries_determine_location()

Helper function that checks locations for LESS libraries.

Parameters

array &$library: Library in question. Paths to found libraries will be added here.

array $locations: Array of paths of potential library installs relative to DRUPAL_ROOT.

array $version_files: Array of key => value pairs, where key is location library version number, and value is the location of that file that to be included when this library is loaded with libraries_load().

2 calls to _less_libraries_determine_location()
_less_lessphp_locate in includes/less.libraries.inc
Locates leafo/lessphp in the many possible places it could be.
_less_less_php_locate in includes/less.libraries.inc
Locates oyejorge/less.php in the many possible places it could be.

File

includes/less.libraries.inc, line 188
Contains Libraries API integration.

Code

function _less_libraries_determine_location(array &$library, array $locations, array $version_files) {
  foreach (array_filter($locations) as $location) {
    foreach ($version_files as $version_file => $class_file) {
      if (file_exists($location . DIRECTORY_SEPARATOR . $version_file)) {
        $library['library path'] = $location;
        $library['files'] = array(
          'php' => array(
            $class_file,
          ),
        );
        $library['version arguments']['file'] = $version_file;
        return;

        // File has been found, skip remaining $locations and $version_files
      }
    }
  }
}