You are here

function file_styles_styles_default_presets in Styles 7.2

Implementation of Styles module hook_styles_default_presets().

File

contrib/file_styles/includes/styles/file_styles.styles.inc, line 86
styles/contrib/file_styles/includes/styles/file_styles.styles.inc Implementations of various Styles hooks.

Code

function file_styles_styles_default_presets() {
  $containers = array();

  // @TODO: The real deal for video/audio/etc.
  foreach (array(
    'image',
    'audio',
    'video',
    'default',
  ) as $type) {
    $containers[$type] = array(
      'default preset' => 'original',
      'styles' => array(
        'thumbnail' => array(
          'default preset' => 'linked_thumbnail',
        ),
        'square_thumbnail' => array(
          'default preset' => 'linked_square_thumbnail',
        ),
        'large' => array(
          'default preset' => 'large',
        ),
        'medium' => array(
          'default preset' => 'medium',
        ),
      ),
      'presets' => array(
        'original' => array(
          array(
            'name' => 'thumbnail',
            'settings' => array(),
          ),
        ),
        'unlinked_thumbnail' => array(
          array(
            'name' => 'imageStyle',
            'settings' => array(
              'image_style' => 'thumbnail',
            ),
          ),
          array(
            'name' => 'thumbnail',
            'settings' => array(),
          ),
        ),
        'linked_thumbnail' => array(
          array(
            'name' => 'linkToMedia',
            'settings' => array(),
          ),
          array(
            'name' => 'imageStyle',
            'settings' => array(
              'image_style' => 'thumbnail',
            ),
          ),
          array(
            'name' => 'thumbnail',
            'settings' => array(),
          ),
        ),
        'linked_square_thumbnail' => array(
          array(
            'name' => 'linkToMedia',
            'settings' => array(),
          ),
          array(
            'name' => 'imageStyle',
            'settings' => array(
              'image_style' => 'square_thumbnail',
            ),
          ),
          array(
            'name' => 'thumbnail',
            'settings' => array(),
          ),
        ),
        'large' => array(
          array(
            'name' => 'imageStyle',
            'settings' => array(
              'image_style' => 'large',
            ),
          ),
          array(
            'name' => 'thumbnail',
            'settings' => array(),
          ),
        ),
        'medium' => array(
          array(
            'name' => 'imageStyle',
            'settings' => array(
              'image_style' => 'medium',
            ),
          ),
          array(
            'name' => 'thumbnail',
            'settings' => array(),
          ),
        ),
      ),
    );
  }
  foreach (image_styles() as $style_name => $style) {
    if (!isset($containers['image']['presets'][$style_name])) {
      $containers['image']['presets'][$style_name] = array(
        array(
          'name' => 'imageStyle',
          'settings' => array(
            'image_style' => $style_name,
          ),
        ),
        array(
          'name' => 'thumbnail',
          'settings' => array(),
        ),
      );
    }
  }
  return array(
    'file' => array(
      'containers' => $containers,
    ),
  );
}