public static function BreakpointGroup::ImportMediaQueries in Breakpoints 8
Load breakpoints from a theme/module and build 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.
Return value
\Drupal\breakpoint\BreakpointGroup|false Return the new breakpoint group containing all breakpoints.
2 calls to BreakpointGroup::ImportMediaQueries()
- breakpoint_group_reload_from_theme in ./
breakpoint.module - Reload breakpoint groups as they were defined in the theme.
- _breakpoint_import_media_queries in ./
breakpoint.module - Import media queries from a theme or module and create a default group.
File
- lib/
Drupal/ breakpoint/ BreakpointGroup.php, line 263 - Definition of Drupal\breakpoint\BreakpointGroup.
Class
- BreakpointGroup
- Defines the BreakpointGroup entity.
Namespace
Drupal\breakpointCode
public static function ImportMediaQueries($id, $label, $source_type, $media_queries) {
$breakpoint_group = entity_load('breakpoint_group', $source_type . '.' . $id);
if (!$breakpoint_group) {
// Build a new breakpoint group.
$breakpoint_group = entity_create('breakpoint_group', array(
'id' => $id,
'label' => $label,
'source' => $id,
'sourceType' => $source_type,
));
}
else {
// Reset label.
$breakpoint_group->label = $label;
}
foreach ($media_queries as $name => $media_query) {
$breakpoint_group
->addBreakpointFromMediaQuery($name, $media_query);
}
return $breakpoint_group;
}