function _breakpoint_import_media_queries

Import media queries from a theme or module and create a default group.

Parameters

string $group_name: Machine readable name of the breakpoint group.

string $label: Human readable name of the breakpoint group.

string $source_type: Either Breakpoint::SOURCE_TYPE_THEME or Breakpoint::SOURCE_TYPE_MODULE.

array $media_queries: An array of breakpoints in the form $breakpoint['name'] = 'media query'.

2 calls to _breakpoint_import_media_queries()
_breakpoint_modules_enabled in drupal/core/modules/breakpoint/breakpoint.module
Import breakpoints from all new enabled modules.
_breakpoint_theme_enabled in drupal/core/modules/breakpoint/breakpoint.module
Import breakpoints from all new enabled themes.

File

drupal/core/modules/breakpoint/breakpoint.module, line 134
Manage breakpoints and breakpoint groups for responsive designs.

Code

function _breakpoint_import_media_queries($group_name, $label, $source_type, $media_queries) {
  if (!empty($media_queries)) {

    // Create a new breakpoint group if it doesn't exist.
    $breakpoint_group = _breakpoint_group_create_or_load($group_name, $label, $group_name, $source_type);

    // Load all media queries, create a breakpoint for each one and add them
    // to this breakpoint group.
    foreach ($media_queries as $name => $media_query) {
      $breakpoint_group
        ->addBreakpointFromMediaQuery($name, $media_query);
    }
    $breakpoint_group
      ->save();
  }
}