*/ /** * Created a render array with taxon node information like states. * * @param array $taxon_nodes * * @gropup compose */ function compose_taxon_node_status(array $taxon_nodes){ $render_array = []; RenderHints::pushToRenderStack("taxon_nodes"); RenderHints::setFootnoteListKey('taxon_nodes'); if($taxon_nodes && count($taxon_nodes) > 0){ $label_plural = false; $status_markup_tokens = []; foreach ($taxon_nodes as $taxon_node){ $annotations_and_sources = handle_annotations_and_sources($taxon_node, array( 'sources_as_content' => false, 'link_to_name_used_in_source' => false, 'link_to_reference' => true, 'add_footnote_keys' => true, 'bibliography_aware' => false), '', null); if(isset($taxon_node->nodeStatus)){ $state_label = strtolower($taxon_node->nodeStatus->message_L10n); if(isset($taxon_node->statusNote_L10n->text)){ $state_label .= ' (' . $taxon_node->statusNote_L10n->text . ')'; } $classification = cdm_ws_get(CDM_WS_CLASSIFICATION, array($taxon_node->classificationUUID)); $status_markup_tokens[$state_label . '-' . $taxon_node->uuid] = [ 'status' => '' . $state_label . $annotations_and_sources['foot_note_keys'] . '%s', // %s will be replaced by the $classification_markup or by '', 'classification' => ' [' . $classification->titleCache . ']' ]; } } if(count($status_markup_tokens) > 0){ ksort($status_markup_tokens); $status_markup = []; $label_plural |= count($status_markup_tokens) > 1; $label = $label_plural ? t('Placement status') : t('Placement status'); if(count($status_markup_tokens) > 1){ foreach ($status_markup_tokens as $tokes){ $status_markup[] = sprintf($tokes['status'], $tokes['classification']); } } else { foreach ($status_markup_tokens as $tokes){ $status_markup[] = sprintf($tokes['status'], ''); } } $render_array['taxon-node-status'] = markup_to_render_array($label . ': ' . join('; ', $status_markup) . theme('cdm_footnotes', array('footnoteListKey' => RenderHints::getFootnoteListKey()))); $render_array['taxon-node-status']['#prefix'] = '