function rlayout_breakpoints_load_all in Layout 8
Helper function to return processed breakpoint information for layouts.
@todo Currently tied to one breakpoint group in rlayout, but it should be made independent and configurable.
2 calls to rlayout_breakpoints_load_all()
- RLayoutFormController::form in lib/
Drupal/ rlayout/ RLayoutFormController.php - Overrides Drupal\Core\Entity\EntityFormController::form().
- rlayout_breakpoint_get_css in ./
rlayout.module - Build CSS for the breakpoints with media queries.
File
- ./
rlayout.module, line 135 - Responsive layout builder tool for Panels.
Code
function rlayout_breakpoints_load_all() {
$grid_breakpoints = entity_load('breakpoint_group', 'module.rlayout.rlayout');
$breakpoint_info = array();
foreach ($grid_breakpoints->breakpoints as $key => $breakpoint) {
// Only include this breakpoint in the output if we found a grid for it.
// Other type of breakpoints are not useful for us, since we cannot display
// an editing interface without a grid for each breakpoint.
if ($grid = rlayout_breakpoint_find_grid($key)) {
// @todo This considers em and px based widths the same number. This is due
// to the JS responsive layout designer not being able to take qualified
// widths. It can only take numbers. Should be fixed there first and then
// here.
$low_width = 0;
if (preg_match('!min-width: (\\d+)[ep]!', $breakpoint->mediaQuery, $found)) {
$low_width = $found[1];
}
$breakpoint_info[$key] = (object) array(
'id' => $key,
'label' => $breakpoint->label,
'width' => $low_width,
'grid' => $grid,
'mediaQuery' => $breakpoint->mediaQuery,
);
}
}
return $breakpoint_info;
}