Hi,

I am making custom formatter and want to integrate it with colorbox. I t works fine. But I can not figure out how to add slide functionality if thare are more than one picture attached. Could you pls help me with it?

function theme_custommy_formatter_table($variables) {
//dpr($variables);


  $header = array(t('Preview'), t('Attachment'), t('Size'));
  $rows = array();
  foreach ($variables['items'] as $delta => $item) {
  
  $opt = array('image/jpeg', 'image/gif', 'image/png');
if (in_array($item['filemime'], $opt)) {


 $preview = '<a class="colorbox" href="' . file_create_url($item['uri']) . '"><img src="' . image_style_url('thumbnail', $item['uri']) . '"></a>'; 
 }
  else 
  { $preview = '';}
  

  
    $rows[] = array(
	$preview,
      theme('file_link', array('file' => (object) $item)),
      format_size($item['filesize']),
    );
  }

  return empty($rows) ? '' : theme('table', array('header' => $header, 'rows' => $rows));
}

brgds

Comments

frjo’s picture

The Colorbox plugin will group all links with the same rel attribute value.

Oleksa-1’s picture

Status: Active » Closed (fixed)

Interesting. Thx a lot, I will give it a try.