diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/BreakpointsTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/BreakpointsTest.php new file mode 100644 index 0000000..08bbedd --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Tests/Common/BreakpointsTest.php @@ -0,0 +1,36 @@ + 'Breakpoints', + 'description' => 'Tests retrieving breakpoints from theme info.', + 'group' => 'Common', + ); + } + + /** + * Tests retrieving breakpoints from theme info. + */ + function testBreakpoints() { + $expected = array( + 'mobile' => '(min-width: 0em)', + 'wide' => 'screen and (min-width: 40em)', + ); + // theme_enable is needed so config gets loaded. + theme_enable(array('seven')); + $this->assertEqual(system_breakpoint_list('seven'), $expected); + } +} diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 922b8a7..4f04a24 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -3126,6 +3126,27 @@ function system_region_list($theme_key, $show = REGIONS_ALL) { } /** + * Get a list of available breakpoints from a specified theme. + * + * @param $theme_key + * The name of a theme. + * @return + * An array of breakpoints in the form $breakpoint['name'] = 'media query'. + */ +function system_breakpoint_list($theme_key) { + $themes = list_themes(); + if (!isset($themes[$theme_key])) { + return array(); + } + + $config = config($theme_key . '.breakpoints'); + if ($config) { + return $config->get(); + } + return array(); +} + +/** * Implements hook_system_info_alter(). */ function system_system_info_alter(&$info, $file, $type) { diff --git a/core/themes/bartik/config/bartik.breakpoints.yml b/core/themes/bartik/config/bartik.breakpoints.yml new file mode 100644 index 0000000..eec56bb --- /dev/null +++ b/core/themes/bartik/config/bartik.breakpoints.yml @@ -0,0 +1,3 @@ +mobile: '(min-width: 0px)' +narrow: 'all and (min-width: 560px) and (max-width:850px)' +wide: 'all and (min-width: 851px)' \ No newline at end of file diff --git a/core/themes/seven/config/seven.breakpoints.yml b/core/themes/seven/config/seven.breakpoints.yml new file mode 100644 index 0000000..36d65a3 --- /dev/null +++ b/core/themes/seven/config/seven.breakpoints.yml @@ -0,0 +1,2 @@ +mobile: '(min-width: 0em)' +wide: 'screen and (min-width: 40em)' \ No newline at end of file diff --git a/core/themes/seven/seven.info b/core/themes/seven/seven.info index 969f749..c2782c9 100644 --- a/core/themes/seven/seven.info +++ b/core/themes/seven/seven.info @@ -3,9 +3,12 @@ description = A simple one-column, tableless, fluid width administration theme. package = Core version = VERSION core = 8.x + stylesheets[screen][] = reset.css stylesheets[screen][] = style.css + settings[shortcut_module_link] = 1 + regions[content] = Content regions[help] = Help regions[page_top] = Page top diff --git a/core/themes/stark/config/stark.breakpoints.yml b/core/themes/stark/config/stark.breakpoints.yml new file mode 100644 index 0000000..87ac036 --- /dev/null +++ b/core/themes/stark/config/stark.breakpoints.yml @@ -0,0 +1,3 @@ +mobile: '(min-width: 0px)' +narrow: 'all and (min-width: 480px) and (max-width: 959px)' +wide: 'all and (min-width: 960px)' \ No newline at end of file diff --git a/core/themes/stark/stark.info b/core/themes/stark/stark.info index fbab2a0..83ba50b 100644 --- a/core/themes/stark/stark.info +++ b/core/themes/stark/stark.info @@ -3,4 +3,5 @@ description = This theme demonstrates Drupal's default HTML markup and CSS style package = Core version = VERSION core = 8.x + stylesheets[all][] = css/layout.css