Project

General

Profile

« Previous | Next » 

Revision 50a67433

Added by Andreas Kohlbecker about 8 years ago

replacing special code for cichorieae feature 'Image source' by generic functionality

View differences:

modules/cdm_dataportal/includes/common.inc
178 178
 * @param $a
179 179
 * @param $b
180 180
 */
181
function compare_image_sources($a, $b) {
181
function compare_text_data($a, $b) {
182 182

  
183 183
  if ($a->multilanguageText_L10n->text == $b->multilanguageText_L10n->text) {
184 184
    return 0;
modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
341 341
}
342 342

  
343 343

  
344
/**
345
 * @todo Please document this function.
346
 * @see http://drupal.org/node/1354
347
 */
348
function theme_cdm_description_element_image_source($variables) {
349
  $image_sources = $variables['image_sources'];
350
  $asListElement = $variables['asListElement'];
351
  $out = '';
352
  $separator = ',';
353
  RenderHints::pushToRenderStack('descriptionElementImageSource');
354
  RenderHints::setFootnoteListKey(UUID_IMAGE_SOURCES);
355

  
356
  // Sorting the image sources.
357
  usort($image_sources, 'compare_image_sources');
358
  // Generate the footnotes.
359
  foreach ($image_sources as $image_source) {
360
    $footNoteKeys = cdm_annotations_as_footnotekeys($image_source);
361
    foreach ($image_source->sources as $source) {
362
      if (_is_original_source_type($source)) {
363
        $fn_key = FootnoteManager::addNewFootnote(original_source_footnote_list_key(), theme('cdm_OriginalSource', array(
364
          'source' => $source,
365
          'doLink' => FALSE,
366
        )));
367
        // Ensure uniqueness of the footnote keys.
368
        cdm_add_footnote_to_array($footNoteKeys, $fn_key);
369
      }
370
    }
371
    // Sort and render footnote keys.
372
    $footnote_key_list_str = '';
373
    asort($footNoteKeys);
374
    foreach ($footNoteKeys as $footNoteKey) {
375
      $footnote_key_list_str .= theme('cdm_footnote_key', array('footnoteKey' => $footNoteKey, 'separator' => ($footnote_key_list_str ? $separator : '')));
376
    }
377
    // Return value!
378
    $out .= '<span class="descriptionElement descriptionElement-' . $image_source->uuid . '">' . $image_source->multilanguageText_L10n->text . $footnote_key_list_str . '; </span>';
379
  }
380

  
381
  RenderHints::popFromRenderStack();
382
  return $out;
383
}
384 344

  
385 345
/**
386 346
 * @todo Please document this function.

Also available in: Unified diff