function file_styles_styles_containers in Styles 7
Implements hook_styles_containers().
File
- contrib/
file_styles/ file_styles.module, line 11 - File widget formatter definitions.
Code
function file_styles_styles_containers() {
$containers = array(
'file' => array(
'field_name' => 'file',
'admin' => array(
'path' => 'admin/config/media/file-styles',
'access arguments' => array(
'administer file styles',
),
),
'help' => t('Each of the following containers defines a set of styles that will be applied when a file is of the specified type. For instance, if a file field allows images and videos, a specific style might be defined for \'Thumbnail\', that will display a cropped image when a JPEG is given, or a thumbnail linking to a shadowboxed video when an MPEG is stored.'),
'containers' => array(
'image' => array(
'label' => t('Image'),
'weight' => 0,
'data' => array(
'streams' => array(
'public',
'private',
),
'mimetypes' => array(
'image/png',
'image/gif',
'image/jpeg',
),
),
'filter callback' => 'file_styles_styles_formatter_filter',
'themes' => array(
'field_formatter_styles' => 'file_styles_field_formatter_styles',
'styles' => 'file_styles_image',
'preview' => 'file_styles_image_style_preview',
),
'description' => t('Image Styles will transform images to your choosing, such as by scaling and cropping. You can !manage.', array(
'!manage' => l(t('manage your image styles here'), 'admin/config/media/image-styles'),
)),
),
),
),
);
// The Image container is thus far the same.
$containers['image'] = $containers['file'];
unset($containers['image']['admin']);
// Now add Video & Audio support, plus a default fallback.
$containers['file']['containers']['video'] = array(
'label' => t('Video'),
'weight' => 0,
'data' => array(
'streams' => array(
'public',
'private',
),
'mimetypes' => array(
'video/mp4',
'video/ogg',
),
),
'filter callback' => 'file_styles_styles_formatter_filter',
'themes' => array(
'field_formatter_styles' => 'file_styles_field_formatter_styles',
'styles' => 'file_styles_video',
'preview' => 'file_styles_video_style_preview',
),
'description' => t('Video Styles will transform videos to your choosing, such as by scaling and adding autoplay. You can !manage.', array(
'!manage' => l(t('manage your video styles here'), 'admin/config/media/video-styles'),
)),
);
$containers['file']['containers']['default'] = array(
'label' => t('Default'),
'weight' => 10,
'data' => array(),
'filter callback' => 'file_styles_styles_formatter_filter_default',
'themes' => array(
'field_formatter_styles' => 'file_styles_field_formatter_styles_default',
'styles' => 'file_styles_styles_default',
'preview' => 'file_styles_preview_default',
),
);
return $containers;
}