You are here

function media_gallery_styles_default_presets_alter in Media Gallery 7

Same name and namespace in other branches
  1. 7.2 media_gallery.module \media_gallery_styles_default_presets_alter()

Implements hook_styles_default_presets_alter().

File

./media_gallery.module, line 1589

Code

function media_gallery_styles_default_presets_alter(&$styles) {
  foreach (array_keys(media_gallery_image_default_styles()) as $image_style) {
    foreach (array(
      'image',
      'media_youtube',
    ) as $container) {
      $styles['file']['containers'][$container]['styles'][$image_style]['default preset'] = $image_style;
      $styles['file']['containers'][$container]['presets'][$image_style] = array(
        array(
          // @todo Styles 2.0-alpha6 and later uses 'imageStyle', while earlier
          //   versions use 'image_style'. Change to simply using 'imageStyle'
          //   when it's okay to drop compatibility with the earlier versions.
          'name' => class_exists('FileStyles') && method_exists('FileStyles', 'imageStyle') ? 'imageStyle' : 'image_style',
          'settings' => array(
            'image_style' => $image_style,
          ),
        ),
        array(
          'name' => 'thumbnail',
          'settings' => array(),
        ),
      );
    }
  }
  $styles['file']['containers']['media_youtube']['styles']['media_gallery_large']['default preset'] = 'video';
}