Project

General

Profile

« Previous | Next » 

Revision 4feafea8

Added by Andreas Kohlbecker about 7 years ago

fix #6374 fixing messed up UUIDs and harmonizing use descriptions block creation

View differences:

modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
363 363
 * @see http://drupal.org/node/1354
364 364
 */
365 365
function theme_cdm_UseDescription($variables) {
366

  
367

  
368
  RenderHints::pushToRenderStack('block_Uses');
369

  
366 370
  $descriptions = $variables['description'];
367 371
  $taxonUuid = $variables['taxonUuid'];
368
  $out = '<div id="content"><ul id="Description" class ="description">';
372
  $out = '<ul id="Description" class ="description">';
369 373
  if ($descriptions == NULL) {
370
    return;
374
    return '';
371 375
  }
372 376

  
373
  $feature_block_settings = get_feature_block_settings(UUID_DISTRIBUTION);
377
  $feature_block_settings = get_feature_block_settings(UUID_DISTRIBUTION); //FIXME wrong UUID here
374 378

  
375 379
  $descriptionSynonyms = '';
376 380
  $descriptionOut = '';
......
478 482
  }
479 483
  $out .= $descriptionOut . $synonymOut;
480 484
  $out .= "</ul></div>";
485

  
486
  RenderHints::popFromRenderStack();
487

  
481 488
  return $out;
482 489
}
483 490

  
484 491

  
485 492
/**
486
 * The theming function for a block of Uses Descriptions for a given taxon.
493
 * Provides the content for a block of Uses Descriptions for a given taxon.
494
 *
495
 * Fetches the list of TaxonDescriptions tagged with the MARKERTYPE_USE
496
 * and passes them to the theme function theme_cdm_UseDescription().
487 497
 *
488
 * The Uses block has been removed from the code but the according theme function
489
 * is kept for compatibility reasons with existing code regarding palmweb.
498
 * @param string $taxon_uuid
499
 *   The uuid of the Taxon
490 500
 *
501
 * @return array
502
 *   A drupal render array
491 503
 */
492
function theme_cdm_block_Uses($variables) {
493
  $taxonUuid = $variables['taxonUuid'];
494
  RenderHints::pushToRenderStack('block_Uses');
504
function cdm_block_use_description_content($taxon_uuid) {
495 505

  
496
  if ($taxonUuid == NULL) {
497
    return;
498
  }
499
  $out = '';
500
  $markerTypes = array();
501
  $markerTypes['markerTypes'] = UUID_MARKERTYPE_USE;
502
  $useDescriptions = cdm_ws_fetch_all(CDM_WS_PORTAL_TAXON . '/' . $taxonUuid . '/descriptions', $markerTypes);
503
  if (!empty($useDescriptions)) {
504
    // FIXME use theme_block instaed of hardcoding the block html here !!!!
505
    $out .= '<div id="block-cdm_dataportal-feature-description" class="clear-block block block-cdm_dataportal-feature"><H2><a name="userecords"> </a> Uses </H2>';
506
    $formatUseDescriptions = theme('cdm_UseDescription', array('description' => $useDescriptions, 'taxonUuid' => $taxonUuid));
507

  
508
    $out .= $formatUseDescriptions;
509
    $out .= "</div>";
506
  $use_description_content = '';
507

  
508
  if (is_uuid($taxon_uuid )) {
509
    $markerTypes = array();
510
    $markerTypes['markerTypes'] = UUID_MARKERTYPE_USE;
511
    $useDescriptions = cdm_ws_fetch_all(CDM_WS_PORTAL_TAXON . '/' . $taxon_uuid . '/descriptions', $markerTypes);
512
    if (!empty($useDescriptions)) {
513
      $use_description_content = theme('cdm_UseDescription', array('description' => $useDescriptions, 'taxonUuid' => $taxon_uuid));
514
    }
510 515
  }
511 516

  
512
  return $out;
517
  return markup_to_render_array($use_description_content);
513 518
}

Also available in: Unified diff