brilliant_gallery_formatters.inc in Brilliant Gallery 7
File
brilliant_gallery_formatters.inc
View source
<?php
function brilliant_gallery_field_formatter_info() {
return array(
'brilliant_gallery_render' => array(
'label' => t('Brilliant Gallery: local path, BT Sync secret (default 33 bytes only), Picasa RSS link or Google+ album URL'),
'field types' => array(
'text',
),
),
'brilliant_gallery_single' => array(
'label' => t('A random image from Brilliant Gallery: local path, BT Sync secret (default 33 bytes only), Picasa RSS link or Google+ album URL'),
'field types' => array(
'text',
),
),
);
}
function brilliant_gallery_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
switch ($display['type']) {
case 'brilliant_gallery_render':
foreach ($items as $delta => $item) {
$pathurl = trim($item['value']);
if (function_exists('replace_brilliant_gallery_tags') and $pathurl != '') {
$result = '';
$bgcode = '[bg|' . $pathurl . ']';
$gallery = replace_brilliant_gallery_tags($bgcode);
if (strip_tags($gallery) != '') {
$result .= $gallery;
}
$element[$delta] = array(
'#markup' => $result,
);
}
}
break;
case 'brilliant_gallery_single':
foreach ($items as $delta => $item) {
$pathurl = trim($item['value']);
if (function_exists('replace_brilliant_gallery_tags') and $pathurl != '') {
$result = '';
$bgcode = '[bg|' . $pathurl . '|0|' . variable_get('brilliant_gallery_maximagewidth', 150) . '|random|1]';
$gallery = replace_brilliant_gallery_tags($bgcode);
if (strip_tags($gallery) != '') {
$result .= $gallery;
}
$element[$delta] = array(
'#markup' => $result,
);
}
}
break;
}
return $element;
}