You are here

function template_preprocess_dnd_library_item in Scald: Media Management made easy 6

Completely contrived edit item theme function

1 call to template_preprocess_dnd_library_item()
template_preprocess_dnd_library_preview in dnd/modules/dnd_test/dnd_test.module
Completely contrived library preview theme function

File

dnd/modules/dnd_test/dnd_test.module, line 132

Code

function template_preprocess_dnd_library_item(&$variables) {
  global $_SERVER;
  $i = $variables['i'];
  if ($i % 3 == 0) {
    $img = 3;
  }
  else {
    if ($i % 2 == 0) {
      $img = 2;
    }
    else {
      $img = 1;
    }
  }
  $variables['img_num'] = $img;
  $variables['id'] = 'dnd-test-' . $i;
  $variables['image'] = '<img src="http://' . $_SERVER['HTTP_HOST'] . base_path() . drupal_get_path('module', 'dnd_test') . '/img/item-' . $img . '-thumb.jpg?dnd_id=' . $i . '-M" class="drop" />';
  $variables['title'] = t('Lorem Ipsum @count', array(
    '@count' => $i,
  ));
  $variables['date'] = 'Feb 18 2009';
  $variables['author'] = 'David Eads';
  foreach (array(
    t('S'),
    t('M'),
    t('L'),
  ) as $size) {
    $sizes[] = '<img src="http://' . $_SERVER['HTTP_HOST'] . base_path() . drupal_get_path('module', 'dnd_test') . '/img/icon/' . $size . '.png?dnd_id=' . $i . '-' . $size . '" class="drop" />';
  }
  $variables['sizes'] = '<ul><li>' . implode('</li><li>', $sizes) . '</li></ul>';
}