You are here

function _less_libraries_determine_location in Less CSS Preprocessor 7.3

Same name and namespace in other branches
  1. 8 includes/less.libraries.inc \_less_libraries_determine_location()
  2. 7.4 includes/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 ./less.libraries.inc
Locates leafo/lessphp in the many possible places it could be.
_less_less_php_locate in ./less.libraries.inc
Locates oyejorge/less.php in the many possible places it could be.

File

./less.libraries.inc, line 172
Contains Libraries API integration.

Code

function _less_libraries_determine_location(&$library, $locations, $version_files) {
  foreach ($locations as $location) {
    if ($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;
          break 2;

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