View source
<?php
function navbar_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$libraries = array(
'modernizr' => 'Modernizr',
'underscore' => 'Underscore',
'backbone' => 'Backbone',
);
foreach ($libraries as $lib => $label) {
$requirements['navbar_' . $lib] = array(
'title' => t('Navbar: @library library', array(
'@library' => $label,
)),
'value' => t('The @library library is not present', array(
'@library' => $label,
)),
'severity' => REQUIREMENT_ERROR,
);
if (function_exists('libraries_detect')) {
if (($library = libraries_detect($lib)) && !empty($library['installed'])) {
$requirements['navbar_' . $lib]['value'] = t('@version (@variant)', array(
'@version' => $library['version'],
'@variant' => _navbar_libraries_get_preferred_variant_name($library),
));
$requirements['navbar_' . $lib]['severity'] = REQUIREMENT_OK;
}
elseif (!empty($library['error'])) {
$requirements['navbar_' . $lib]['description'] = $library['error message'];
}
}
}
}
return $requirements;
}
function navbar_update_7000() {
$wide = breakpoints_breakpoint_load('wide', 'navbar', 'module');
$wide->weight = 2;
breakpoints_breakpoint_save($wide);
$narrow = breakpoints_breakpoint_load('narrow', 'navbar', 'module');
if (empty($narrow)) {
$breakpoint = new stdClass();
$breakpoint->disabled = FALSE;
$breakpoint->api_version = 1;
$breakpoint->name = 'narrow';
$breakpoint->breakpoint = 'only screen and (min-width: 16.5em)';
$breakpoint->source = 'navbar';
$breakpoint->source_type = 'module';
$breakpoint->status = 1;
$breakpoint->weight = 0;
$breakpoint->multipliers = array();
breakpoints_breakpoint_save($breakpoint);
}
$standard = breakpoints_breakpoint_load('standard', 'navbar', 'module');
if (empty($standard)) {
$breakpoint = new stdClass();
$breakpoint->disabled = FALSE;
$breakpoint->api_version = 1;
$breakpoint->name = 'standard';
$breakpoint->breakpoint = 'only screen and (min-width: 38.125em)';
$breakpoint->source = 'navbar';
$breakpoint->source_type = 'module';
$breakpoint->status = 1;
$breakpoint->weight = 1;
$breakpoint->multipliers = array();
breakpoints_breakpoint_save($breakpoint);
}
}
function navbar_update_7001() {
if (drupal_load('module', 'breakpoints')) {
foreach (breakpoints_breakpoint_load_all() as $breakpoint) {
$identifiers = explode('.', $breakpoint->machine_name);
if ($identifiers[1] === 'module' && $identifiers[2] === 'navbar') {
breakpoints_breakpoint_delete($breakpoint);
}
}
}
}