Project

General

Profile

Revision 4feeabc7

ID4feeabc7eb75a09ab5a445413a4b6a3505c49e37
Parent 4b3be949
Child ed0183ea

Added by Andreas Kohlbecker almost 4 years ago

fix #4490 taxon page tab labels configurable and fixing translation issue with menu items

View differences:

modules/cdm_dataportal/includes/pages.inc
492 492
  if (array_search('images', taxon_page_tabs_hidden()) === FALSE && ($page_part == 'images' || $page_part == 'all')) {
493 493
    $images_html = '<div id="images" class="page-part">';
494 494
    if ($page_part == 'all') {
495
      $images_html .= '<h2>' . t('Images') . '</h2>';
495
      $images_html .= '<h2>' . t(cdm_taxonpage_tab_label('Images')) . '</h2>';
496 496
    }
497 497
    // Get the image gallery as configured by the admin.
498 498
    $default_image_gallery = 'default';
499 499
    $configured_image_gallery_viewer = variable_get('image_gallery_viewer', 'default');
500
    $taxon_image_gallery = '<div class="error">No image gallery viewer configured</div>';
500 501
    if($configured_image_gallery_viewer == $default_image_gallery || $configured_image_gallery_viewer == 'fsi'){
501 502
      // the fsi_gallery requires a flash plugin, in case the client browser is not supporting
502 503
      // flash we also need to provide an the default gallery as alternative
......
524 525
  if (($page_part == 'synonymy' || $page_part == 'all')) {
525 526
    $synonymy_html = '<div id="synonymy" class="page-part">';
526 527
    if ($page_part == 'all') {
527
      $synonymy_html .= '<h2>' . t('Synonymy') . '</h2>';
528
      $synonymy_html .= '<h2>' . t(cdm_taxonpage_tab_label('Synonymy')) . '</h2>';
528 529
    }
529 530
    $addAcceptedTaxon = variable_get('cdm_dataportal_nomref_in_title', CDM_DATAPORTAL_NOMREF_IN_TITLE);
530 531

  
......
538 539
  // --- PAGE PART: SPECIMENS --- //
539 540
  if ($specimensOrObservationsCount > 0 && ($page_part == 'specimens' || $page_part == 'all')) {
540 541
    $render_array['specimens'] = array(
541
        '#prefix' => '<div id="specimens" class="page-part">' . ($page_part == 'all' ? '<h2>' . t('Specimens') . '</h2>' : ''),
542
        '#prefix' => '<div id="specimens" class="page-part">' . ($page_part == 'all' ? '<h2>' . t(cdm_taxonpage_tab_label('Specimens')) . '</h2>' : ''),
542 543
        'content' => cdm_dataportal_taxon_page_specimens($taxon), // returns render array
543 544
        '#suffix' => '</div>',
544 545
    );
......
551 552
  else if ($identificationKeyCount > 0 && ($page_part == 'keys' || $page_part == 'all')) {
552 553
    $keys_html = '<div id="keys" class="page-part">';
553 554
    if ($page_part == 'all') {
554
      $keys_html .= '<h2>' . t('Keys') . '</h2>';
555
      $keys_html .= '<h2>' . t(cdm_taxonpage_tab_label('Keys')) . '</h2>';
555 556
    }
556 557
    $keys_html .= theme('cdm_block_IdentificationKeys', array('taxonUuid' => $taxon->uuid));
557 558
    $keys_html .= '</div>';
......
562 563

  
563 564
  if (array_search('experts', taxon_page_tabs_hidden()) === FALSE && ($page_part == 'experts' || $page_part == 'all')) {
564 565
    $render_array['experts'] = array(
565
        '#prefix' => '<div id="experts" class="page-part">' . ($page_part == 'all' ? '<h2>' . t('Experts') . '</h2>' : ''),
566
        '#prefix' => '<div id="experts" class="page-part">' . ($page_part == 'all' ? '<h2>' . t(cdm_taxonpage_tab_label('Experts')) . '</h2>' : ''),
566 567
        'content' => compose_cdm_taxon_page_experts($taxon), // returns render array
567 568
        '#suffix' => '</div>',
568 569
    );
......
571 572
  // ------------------ END OF PARTS -------------- //
572 573

  
573 574
  // adjust weights of page and toc elements according to the settings
574
  $taxontabs_weights = get_array_variable_merged('cdm_taxonpage_tabs_weight', CDM_TAXONPAGE_TAB_WEIGHT_DEFAULT);
575
  $taxontabs_weights = get_array_variable_merged(CDM_TAXONPAGE_TAB_WEIGHT, CDM_TAXONPAGE_TAB_WEIGHT_DEFAULT);
575 576
  foreach($taxontabs_weights as $tab_key => $weight){
576 577
    if(isset($render_array[$tab_key])){
577 578
      $render_array[$tab_key]['#weight'] = $weight;
......
588 589
        if($tab_key != 'general'){
589 590
          // add entry for page part
590 591
          $toc_elements[] = array(
591
              'data' => l(t('@tab-name', array('@tab-name' => ucfirst($tab_key))), $_GET['q'], array('fragment' => $tab_key, 'query' => $http_request_params)),
592
              'data' => l(t(cdm_taxonpage_tab_label(ucfirst($tab_key))), $_GET['q'], array('fragment' => $tab_key, 'query' => $http_request_params)),
592 593
              'class' => array('page-part-toc-item-' . $tab_key)
593 594
          );
594 595
        } else {
......
1117 1118
  RenderHints::popFromRenderStack();
1118 1119
  return $render_array;
1119 1120
}
1121

  
1122
/**
1123
 * Provides the the label string for taxon page tabs.
1124
 *
1125
 * The $tabname as passed to the method will be returned if no override
1126
 * label is configured in the settings.
1127
 */
1128
function cdm_taxonpage_tab_label($tabname) {
1129
  static $taxon_tabs_labels = null;
1130
  if($taxon_tabs_labels == null){
1131
    $taxon_tabs_labels = get_array_variable_merged(CDM_TAXONPAGE_TAB_LABELS, CDM_TAXONPAGE_TAB_LABELS_DEFAULT);
1132
  }
1133
  $tabname_key = strtolower($tabname);
1134
  if(isset($taxon_tabs_labels[$tabname_key]) && $taxon_tabs_labels[$tabname_key]){
1135
    return $taxon_tabs_labels[$tabname_key];
1136
  }
1137
  return $tabname;
1138
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)