SHARE
TWEET

Untitled

a guest Jul 17th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function rosettabooks_imagecache_formatter_gridshadow_linked($element) {
  2.   // Inside a view $element may contain NULL data. In that case, just return.
  3.   if (empty($element['#item']['fid'])) {
  4.     return '';
  5.   }
  6.   // Extract the preset name from the formatter name.
  7.   $presetname = substr($element['#formatter'], 0, strrpos($element['#formatter']
  8. , '_'));
  9.   $style = 'linked';
  10.  
  11.   $item = $element['#item'];
  12.   $item['data']['alt'] = isset($item['data']['alt']) ? $item['data']['alt'] : '';
  13.   $item['data']['title'] = isset($item['data']['title']) ? $item['data']['title'] : NULL;
  14.  
  15. if ( !empty( $element['#node']->title) ) {
  16.   $item['data']['alt'] = check_plain($element['#node']->title);
  17.   $item['data']['title'] = check_plain($element['#node']->title);
  18.  
  19.   }else{
  20.   $item['data']['alt'] = check_plain($element['#node']->node_title);
  21.   $item['data']['title'] = check_plain($element['#node']->node_title);
  22.  
  23.   }
  24.  
  25.   $imagetag = theme('imagecache', $presetname, $item['filepath'], $item['data']['alt'], $item['data']['title']);
  26.   $path = empty($item['nid']) ? '' : 'node/'. $item['nid'];
  27.   $class = "imagecache imagecache-$presetname imagecache-$style imagecache-{$element['#formatter']}";
  28.   return l($imagetag, $path, array('attributes' => array('class' => $class), 'html' => TRUE));
  29. }
RAW Paste Data
Top