You are here

function theme_asset in Asset 5

Same name and namespace in other branches
  1. 5.2 asset.module \theme_asset()
  2. 6 inc/asset.themes.inc \theme_asset()

Theme rendered assets

1 theme call to theme_asset()
asset_render_macro in ./asset.module
build html from atrributes array.

File

./asset.module, line 1020

Code

function theme_asset($content, $attributes) {
  if ($attributes['formatter'] == "imagecache" || $attributes['format'] == "image") {

    // We don't put images in a div because IE6 doesn't like <a><div><img/></div></a></>
    $align = 'asset-align-' . ($attributes['align'] ? $attributes['align'] : 'none');
    if (strpos($content, 'class')) {
      $content = str_replace("class=\"", "class=\"" . $align . " ", $content);
    }
    else {
      $content = str_replace("/>", "class=\"" . $align . "\"/>", $content);
    }
    return $content;
  }
  else {
    $class = 'asset-' . $attributes['formatter'] . '-' . $attributes['format'];
    $class .= ' asset-align-' . ($attributes['align'] ? $attributes['align'] : 'none');
    $output = '<span class="' . $class . '">' . $content . '</span>';
    return $output;
  }
}