function rlayout_breakpoint_get_css in Layout 8
Build CSS for the breakpoints with media queries.
@todo Figure out a good way to avoid equal max/min-weights in subsequent breakpoints if that is a problem.
Parameters
boolean $include_media_queries: Whether generate one flat CSS without media queries (useful for administration), or wrap breakpoints with media queries (for frontend).
1 call to rlayout_breakpoint_get_css()
- RLayoutFormController::form in lib/
Drupal/ rlayout/ RLayoutFormController.php - Overrides Drupal\Core\Entity\EntityFormController::form().
File
- ./
rlayout.module, line 232 - Responsive layout builder tool for Panels.
Code
function rlayout_breakpoint_get_css($include_media_queries = TRUE) {
$breakpoints = rlayout_breakpoints_load_all();
$breakpoint_css = array();
foreach ($breakpoints as $name => $breakpoint) {
$grid = entity_load('grid', $breakpoint->grid);
if ($include_media_queries) {
$breakpoint_css[] = '@media ' . $breakpoint->mediaQuery . ' {';
// Get grid CSS from gridbuilder and apply some extra indentation.
$breakpoint_css[] = ' ' . str_replace("\n", "\n ", $grid
->getGridCss('.panel-responsive', '.rld-span-' . $name . '_'));
$breakpoint_css[] = "\n}";
}
else {
$breakpoint_css[] = $grid
->getGridCss(NULL, NULL, TRUE);
}
}
$css = join("\n", $breakpoint_css);
return $css;
}