function responsive_menus_style_load in Responsive Menus 7
Same name and namespace in other branches
- 8 responsive_menus.module \responsive_menus_style_load()
Load a single style.
Parameters
string $style: Style id to be loaded.
3 calls to responsive_menus_style_load()
- responsive_menus_admin_form in ./
responsive_menus.module - Admin settings form for which menus to responsify.
- responsive_menus_context_options_form in includes/
context/ responsive_menus_context.inc - Options form callack for context integration.
- responsive_menus_execute in ./
responsive_menus.module - Final execution for Responsive Menus. Add any js/css and settings required.
File
- ./
responsive_menus.module, line 342 - Responsify menus in Drupal.
Code
function responsive_menus_style_load($style, $jq_update_ignore) {
$styles = responsive_menus_styles();
$data =& drupal_static(__FUNCTION__, array());
if (!isset($data[$style]) && !empty($styles[$style])) {
$style_info = $styles[$style];
// @todo module_load_include() the .inc file for the style being loaded.
// Check for this style's requirements.
if (!empty($style_info['jquery_version'])) {
if (!$jq_update_ignore[1]) {
if (!module_exists('jquery_update')) {
// jQuery Update not installed.
drupal_set_message(t('@style style requires !link set to version !version or higher. Please enable jquery_update.', array(
'@style' => $style_info['name'],
'!link' => l(t('jQuery Update'), 'http://drupal.org/project/jquery_update'),
'!version' => $style_info['jquery_version'],
)), 'warning');
$error = TRUE;
}
elseif (version_compare(variable_get('jquery_update_jquery_version', '1.5'), $style_info['jquery_version'], '<')) {
// jQuery Update version not high enough.
drupal_set_message(t('@style style requires !link set to version !version or higher.', array(
'@style' => $style_info['name'],
'!version' => $style_info['jquery_version'],
'!link' => l(t('jQuery Update'), 'admin/config/development/jquery_update', array(
'query' => array(
'destination' => 'admin/config/user-interface/responsive_menus',
),
)),
)), 'warning');
$error = TRUE;
}
}
else {
drupal_set_message(t('@style style requires !link library version !version or higher, but you have opted to provide your own library. Please ensure you have the proper version of jQuery included. (note: this is not an error)', array(
'@style' => $style_info['name'],
'!link' => l(t('jQuery'), 'http://jquery.com'),
'!version' => $style_info['jquery_version'],
)), 'warning');
}
}
// For integration with Libraries.
if (isset($style_info['use_libraries'])) {
// Try libraries module.
if (module_exists('libraries')) {
if ($library = libraries_load($style_info['library'])) {
if (!empty($library['error']) || empty($library['loaded'])) {
drupal_set_message(t('!message !link and extract to your libraries directory as "@library_name". Example: sites/all/libraries/@library_name. If you are getting "version detection" errors, check file permissions on the library.', array(
'!message' => $library['error message'],
'@library_name' => $style_info['library'],
'!link' => l(t('Download it'), $library['download url']),
)), 'error');
$error = TRUE;
}
}
}
else {
// Libraries module not installed.
drupal_set_message(t('@style style requires !link module enabled.', array(
'@style' => $style_info['name'],
'!link' => l(t('Libraries 2.x'), 'http://drupal.org/project/libraries'),
)), 'warning');
$error = TRUE;
}
}
// Check for errors and load into $data if there are none.
if (!isset($error)) {
$data[$style] = $style_info;
return $data[$style];
}
else {
// Something was wrong loading this style.
drupal_set_message(t('Responsive Menus found a problem. Please check the errors.'), 'error');
return FALSE;
}
}
else {
// This style is already loaded.
return $data[$style];
}
return FALSE;
}