>
$align = 'asset-align-'. ($attributes['align'] ? $attributes['align'] : 'none');
$content = str_replace("/>", "class=\"". $align ."\"/>", $content);
return $content;
} else {
$class ='asset-'. $attributes['formatter'] .'-'. $attributes['format'];
$class .=' asset-align-'. ($attributes['align'] ? $attributes['align'] : 'none');
$output =''. $content .'';
return $output;
}
}
/**
* Theme the wizard theme selection table.
*/
function theme_asset_wizard_theme_form($form) {
foreach (element_children($form) as $filename) {
if (file_exists(dirname($filename) .'/asset_wizard.png')) {
$screenshot = theme('image', dirname($filename) .'/asset_wizard.png');
} else {
$screenshot ='No screenshot available';
}
$rows[] = array(
$screenshot,
''. basename(dirname($filename)) .'
'. $filename,
drupal_render($form[$filename]),
);
}
return theme('table', array(t('Screenshot'), t('Name'), ''), $rows);
}
function theme_asset_admin_formatter_defaults($form) {
$formatters = asset_get_formatters();
foreach ($formatters as $type => $exts) {
$rows = array();
foreach ($exts as $ext => $formats) {
unset($form[$type]['asset_default_formatter_'. $type .'_'. $ext]['#title']);
unset($form[$type]['asset_default_formatter_teaser_'. $type .'_'. $ext]['#title']);
$rows[] = array(
$ext,
drupal_render($form[$type]['asset_default_formatter_'. $type .'_'. $ext]),
drupal_render($form[$type]['asset_default_formatter_teaser_'. $type .'_'. $ext]),
);
}
$form[$type]['#value'] = theme('table', array('', 'Full Page', 'Teaser'), $rows);
}
return drupal_render($form);
}
/**
* Default rendering available to all assets.
*/
function theme_asset_render_default($asset) {
if (substr($asset->url, 0, 5) != "http:") {
$asset->url = url($asset->url);
}
$asset->title = $asset->title ? $asset->title : $asset->filename;
return l($asset->title, $asset->url, array('attributes' => array('class' => 'asset')));
}
/**
* Theme the textarea link
*/
function theme_asset_textarea_link($element) {
$link = l(t('Insert Assets'), 'asset/wizard/textarea', array(
'query' => 'textarea=' . $element['#name'],
'attributes' => array(
'class' => 'asset-textarea-link',
'id' => 'asset-link-'. $element['#id'],
'onclick' => "window.open(this.href, 'asset_textarea_link', 'width=614,height=400,scrollbars=yes,status=yes,resizable=yes,toolbar=no,menubar=no'); return false",
)));
$output = '' . $link . '
';
return $output;
}
/**
* Prepare an individual item for viewing in a browser.
*/
function theme_asset_formatter_default($element) {
if (empty($element['#item'])) return '';
$item = $element['#item'];
$teaser = (arg(0) == 'node' && is_numeric(arg(1))) ? FALSE : TRUE;
if(!empty($item['aid'])) {
return asset_lightbox(array($item), FALSE, $teaser);
}
}
?>