You are here

function picture_get_mapping_breakpoints in Picture 7

Same name and namespace in other branches
  1. 7.2 picture.module \picture_get_mapping_breakpoints()

Returns a list with the image styles of a mapping configuration.

Parameters

object $mappings: The mapping configuration.

string $fallback_image_style: Reference to access the evaluated fallback image style.

Return value

array List with the image styles of a mapping configuration. The array has following structure: array( breakpoint_name => array( multiplier => image_style ) )

4 calls to picture_get_mapping_breakpoints()
picture_field_formatter_view in ./picture.module
Implements hook_field_formatter_view().
picture_file_formatter_picture_view in ./picture.file_entity_1.inc
'view callback' for hook_file_formatter_info().
template_preprocess_flexslider_picture_list in flexslider_picture/theme/flexslider_picture.theme.inc
Process the items and prepare the item slides to be rendered.
_picture_filter_prepare_image in ./picture.module
Prepares a Render Array for theme_picture_formatter(). It is similar to picture_field_formatter_view() with modifications for inline images.

File

./picture.module, line 1509
Picture formatter.

Code

function picture_get_mapping_breakpoints($mappings, &$fallback_image_style = NULL) {
  $breakpoint_styles = array();
  if (is_object($mappings)) {
    foreach ($mappings->mapping as $breakpoint_name => $multipliers) {
      if (!empty($multipliers)) {
        foreach ($multipliers as $multiplier => $image_style) {
          if (!empty($image_style)) {
            if (empty($fallback_image_style)) {
              $fallback_image_style = $image_style;
            }
            if (!isset($breakpoint_styles[$breakpoint_name])) {
              $breakpoint_styles[$breakpoint_name] = array();
            }
            $breakpoint_styles[$breakpoint_name][$multiplier] = $image_style;
          }
        }
      }
    }
  }
  return $breakpoint_styles;
}