Project

General

Profile

« Previous | Next » 

Revision 1b756c5f

Added by Andreas Kohlbecker about 7 years ago

fix #6392 test for uses and use records and refactoring of the uses feature block

  • fixing wrong assumptions for cyprus
  • bibliography as pseudo feature block better testable

View differences:

modules/cdm_dataportal/includes/descriptions.inc
679 679
   *
680 680
   * @ingroup compose
681 681
   */
682
  function compose_feature_blocks($mergedFeatureNodes, $taxon) {
682
  function make_feature_block_list($mergedFeatureNodes, $taxon) {
683 683

  
684 684
    $block_list = array();
685 685

  
......
707 707

  
708 708
        if(array_search($node->feature->uuid, $use_description_features) !== false) {
709 709
          // do not show features which belong to the UseDescriptions, these are
710
          // handled by theme_cdm_block_Uses where the according descriptions are
710
          // handled by compose_feature_block_items_use_records() where the according descriptions are
711 711
          // fetched again separately.
712
          // UseDescriptions are a feature special to palmweb
712
          // UseDescriptions are a special feature introduced for palmweb
713 713
          continue;
714 714
        }
715 715

  
......
731 731
        }
732 732

  
733 733
        /*
734
         * Contend/Use Description (Use + UseRecord)
734
         * Content/Use Description (Use + UseRecord)
735 735
         */
736 736
        else if ($node->feature->uuid == UUID_USE_RECORD) {
737
          $block->content[] = cdm_block_use_description_content($taxon->uuid);
737
          $block->content[] = cdm_block_use_description_content($taxon->uuid, $node->feature);
738 738
          $block_content_is_empty = FALSE;
739 739
        }
740 740

  
......
787 787

  
788 788
    drupal_alter('cdm_feature_node_blocks', $block_list, $taxon);
789 789

  
790
    return _block_get_renderable_array($block_list);
790
    return  $block_list;
791 791
  }
792 792

  
793 793
/**
......
1516 1516
            $elements_out_array[] = compose_description_element_common_taxon_name($description_element, $feature_block_settings);
1517 1517
            break;
1518 1518
          case 'Uses':
1519
            /* IGNORE Uses classes, these are handled completely in theme_cdm_UseDescription */
1519
            /* IGNORE Uses classes, these are handled completely in compose_feature_block_items_use_records()  */
1520 1520
            break;
1521 1521
          default:
1522 1522
            $feature_block_has_content = true;
......
2004 2004
 * @return array
2005 2005
 *   A drupal render array
2006 2006
 */
2007
function cdm_block_use_description_content($taxon_uuid) {
2007
function cdm_block_use_description_content($taxon_uuid, $feature) {
2008 2008

  
2009
  $use_description_content = '';
2009
  $use_description_content = array();
2010 2010

  
2011 2011
  if (is_uuid($taxon_uuid )) {
2012 2012
    $markerTypes = array();
2013 2013
    $markerTypes['markerTypes'] = UUID_MARKERTYPE_USE;
2014 2014
    $useDescriptions = cdm_ws_fetch_all(CDM_WS_PORTAL_TAXON . '/' . $taxon_uuid . '/descriptions', $markerTypes);
2015 2015
    if (!empty($useDescriptions)) {
2016
      $use_description_content = theme('cdm_UseDescription', array('description' => $useDescriptions, 'taxonUuid' => $taxon_uuid));
2016
      $use_description_content = compose_feature_block_items_use_records($useDescriptions, $taxon_uuid, $feature);
2017 2017
    }
2018 2018
  }
2019 2019

  
2020
  return markup_to_render_array($use_description_content);
2020
  return $use_description_content;
2021
}
2022

  
2023
/**
2024
 * Creates a trunk of a feature object which can be used to build pseudo feature blocks like the Bibliography.
2025
 *
2026
 * @param $representation_L10n
2027
 * @param String $pseudo_feature_key
2028
 *    Will be set as uuid but should be one of 'BIBLIOGRAPHY', ... more to come. See also get_feature_block_settings()
2029
 *
2030
 * @return object
2031
 *  The feature object
2032
 */
2033
function make_pseudo_feature($representation_L10n, $pseudo_feature_key = null){
2034
  $feature = new stdClass;
2035
  $feature->representation_L10n = $representation_L10n;
2036
  $feature->uuid = $pseudo_feature_key;
2037

  
2038
  return $feature;
2039

  
2021 2040
}
2022 2041

  
2023 2042

  

Also available in: Unified diff