You are here

function _quickedit_libraries_get_preferred_variant_name in Quick Edit 7

Returns the variant that should be loaded based on order preference.

Parameters

array $library: A libraries module library definition array.

Return value

string The name of the variant that should be loaded.

2 calls to _quickedit_libraries_get_preferred_variant_name()
quickedit_requirements in ./quickedit.install
Implements hook_requirements().
_quickedit_convert_libraries_to_library in includes/libraries.inc
Converts a libraries module array to a hook_library array.

File

includes/libraries.inc, line 136
Logic to nicely integrate with Libraries API.

Code

function _quickedit_libraries_get_preferred_variant_name($library) {
  if (!empty($library['variant order'])) {
    foreach ($library['variant order'] as $name) {
      if ($variant = $library['variants'][$name]) {
        if ($variant['installed']) {
          return $name;
        }
      }
    }
  }
  return NULL;
}