-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
34 lines (31 loc) · 1.02 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
function media_buckets_record_files($record)
{
$bucket = MediaBucketsPlugin::getBucketForRecord($record);
if($bucket) {
return $bucket->Files;
}
}
function media_buckets_record_image($record, $index = 0, $imageType = 'thumbnail', $props = array())
{
$bucket = MediaBucketsPlugin::getBucketForRecord($record);
if($bucket) {
if ($index == 'random') {
$files = $bucket->Files;
$count = count($files);
$index = rand(0, $count-1);
}
return item_image($imageType, $props, $index, $bucket);
}
//fallback to record_image
return record_image($record, $imageType, $props);
}
function media_buckets_record_gallery($record, $attrs = array(), $imageType = 'square_thumbnail', $filesShow = false)
{
$bucket = MediaBucketsPlugin::getBucketForRecord($record);
if($bucket) {
return item_image_gallery($attrs, $imageType, $filesShow, $bucket);
}
//fallback to record_image
return record_image($record, $imageType, array());
}