You are here

function breakpoint_group_reload_from_theme in Breakpoints 8

Reload breakpoint groups as they were defined in the theme.

Parameters

string $theme_key: The name of the theme.

Return value

Drupal\breakpoint\BreakpointGroup|false Returns a BreakpointGroup containing the breakpoints defined by the theme.

1 call to breakpoint_group_reload_from_theme()
BreakpointGroup::revert in lib/Drupal/breakpoint/BreakpointGroup.php
Revert a breakpoint group after it has been overridden.

File

./breakpoint.module, line 210
Manage breakpoints and breakpoint groups for responsive designs.

Code

function breakpoint_group_reload_from_theme($theme_key) {

  // Clear caches so theme info is fresh.
  system_rebuild_theme_data();
  drupal_theme_rebuild();
  $themes = list_themes();
  if (isset($themes[$theme_key]) && $themes[$theme_key]->status) {
    $theme_breakpoints = breakpoint_get_theme_media_queries($theme_key);
    if (!empty($theme_breakpoints)) {
      return BreakpointGroup::ImportMediaQueries($theme_key, $themes[$theme_key]->info['name'], Breakpoint::SOURCE_TYPE_THEME, $theme_breakpoints);
    }
  }
  return FALSE;
}