Manage breakpoints and breakpoint groups for responsive designs.

File

core/modules/breakpoint/breakpoint.module
View source
  1. <?php
  2. /**
  3. * @file
  4. * Manage breakpoints and breakpoint groups for responsive designs.
  5. */
  6. use Drupal\Core\Routing\RouteMatchInterface;
  7. /**
  8. * Implements hook_help().
  9. */
  10. function breakpoint_help($route_name, RouteMatchInterface $route_match) {
  11. switch ($route_name) {
  12. case 'help.page.breakpoint':
  13. $output = '';
  14. $output .= '<h3>' . t('About') . '</h3>';
  15. $output .= '<p>' . t('The Breakpoint module keeps track of the height, width, and resolution breakpoints where a responsive design needs to change in order to respond to different devices being used to view the site. This module does not have a user interface. For more information, see the <a href="!docs">online documentation for the Breakpoint module</a>.', array('!docs' => 'https://www.drupal.org/documentation/modules/breakpoint')) . '</p>';
  16. $output .= '<h4>' . t('Terminology') . '</h4>';
  17. $output .= '<dl>';
  18. $output .= '<dt>' . t('Breakpoint') . '</dt>';
  19. $output .= '<dd>' . t('A breakpoint separates the height or width of viewports (screens, printers, and other media output types) into steps. For instance, a width breakpoint of 40em creates two steps: one for widths up to 40em and one for widths above 40em. Breakpoints can be used to define when layouts should shift from one form to another, when images should be resized, and other changes that need to respond to changes in viewport height or width.') . '</dd>';
  20. $output .= '<dt>' . t('Media query') . '</dt>';
  21. $output .= '<dd>' . t('<a href="!w3">Media queries</a> are a formal way to encode breakpoints. For instance, a width breakpoint at 40em would be written as the media query "(min-width: 40em)". Breakpoints are really just media queries with some additional meta-data, such as a name and multiplier information.', array('!w3' => 'http://www.w3.org/TR/css3-mediaqueries/')) . '</dd>';
  22. $output .= '<dt>' . t('Resolution multiplier') . '</dt>';
  23. $output .= '<dd>' . t('Resolution multipliers are a measure of the viewport\'s device resolution, defined to be the ratio between the physical pixel size of the active device and the <a href="http://en.wikipedia.org/wiki/Device_independent_pixel">device-independent pixel</a> size. The Breakpoint module defines multipliers of 1, 1.5, and 2; when defining breakpoints, modules and themes can define which multipliers apply to each breakpoint.') . '</dd>';
  24. $output .= '<dt>' . t('Breakpoint group') . '</dt>';
  25. $output .= '<dd>' . t('Breakpoints can be organized into groups. Modules and themes should use groups to separate out breakpoints that are meant to be used for different purposes, such as breakpoints for layouts or breakpoints for image sizing.') . '</dd>';
  26. $output .= '</dl>';
  27. $output .= '<h3>' . t('Uses') . '</h3>';
  28. $output .= '<dl>';
  29. $output .= '<dt>' . t('Defining breakpoints and breakpoint groups') . '</dt>';
  30. $output .= '<dd>' . t('Modules and themes can use the API provided by the Breakpoint module to define breakpoints and breakpoint groups, and to assign resolution multipliers to breakpoints.') . '</dd>';
  31. $output .= '</dl>';
  32. return $output;
  33. }
  34. }
  35. /**
  36. * Implements hook_themes_installed()
  37. */
  38. function breakpoint_themes_installed($theme_list) {
  39. \Drupal::service('breakpoint.manager')->clearCachedDefinitions();
  40. }
  41. /**
  42. * Implements hook_themes_uninstalled()
  43. */
  44. function breakpoint_themes_uninstalled($theme_list) {
  45. \Drupal::service('breakpoint.manager')->clearCachedDefinitions();
  46. }

Functions