You are here

function _image_features_style_sanitize in Features 7.2

Same name and namespace in other branches
  1. 7 includes/features.image.inc \_image_features_style_sanitize()

Removes unnecessary keys from an image style for export.

Parameters

array $style: Image style definition.

1 call to _image_features_style_sanitize()
image_features_export_render in includes/features.image.inc
Implements hook_features_export_render().

File

includes/features.image.inc, line 105
Features integration for 'image' module.

Code

function _image_features_style_sanitize(array &$style) {

  // Sanitize style: Don't export numeric IDs and things which get overwritten
  // in image_styles() or are code/storage specific. The name property will be
  // the key of the exported $style array.
  $style = array_diff_key($style, array_flip(array(
    'isid',
    'name',
    'module',
    'storage',
  )));

  // Sanitize effects: all that needs to be kept is name, weight and data,
  // which holds all the style-specific configuration. Other keys are assumed
  // to belong to the definition of the effect itself, so not configuration.
  foreach ($style['effects'] as $id => $effect) {
    $style['effects'][$id] = array_intersect_key($effect, array_flip(array(
      'name',
      'data',
      'weight',
    )));
  }
}