function _breakpoint_import_media_queries in Breakpoints 8
Import media queries from a theme or module and create a default group.
Parameters
string $id: Identifier of the breakpoint group.
string $label: Human readable name of the breakpoint group.
string $sourceType: Either Breakpoint::SOURCE_TYPE_THEME or Breakpoint::SOURCE_TYPE_MODULE.
array $media_queries: Array of media queries keyed by id.
2 calls to _breakpoint_import_media_queries()
- breakpoint_modules_enabled in ./
breakpoint.module - Implements hook_modules_enabled().
- breakpoint_themes_enabled in ./
breakpoint.module - Implements hook_themes_enabled().
File
- ./
breakpoint.module, line 92 - Manage breakpoints and breakpoint groups for responsive designs.
Code
function _breakpoint_import_media_queries($id, $label, $source_type, $media_queries) {
if (!empty($media_queries)) {
if ($breakpoint_group = BreakpointGroup::ImportMediaQueries($id, $label, $source_type, $media_queries)) {
$breakpoint_group
->save();
$uri = $breakpoint_group
->uri();
if ($uri) {
$uri_options = $uri;
unset($uri_options['path']);
$uri = $uri['path'];
}
$message = t('The breakpoints from %label are imported.', array(
'%label' => $label,
));
if (module_exists('breakpoint_ui') && $uri) {
$message .= '<p>' . l(t('A new breakpoint group is created for %label.', array(
'%label' => $label,
)), $uri, $uri_options);
}
drupal_set_message($message, 'status');
}
}
// Import custom groups.
_breakpoint_import_breakpoint_groups($id, $source_type);
}