Revision 81f313f0
Added by Andreas Kohlbecker almost 4 years ago
modules/cdm_dataportal/includes/taxon-node.inc | ||
---|---|---|
29 | 29 |
$render_array = []; |
30 | 30 |
if($taxon_nodes && count($taxon_nodes) > 0){ |
31 | 31 |
$label_plural = false; |
32 |
$states_markup_tokens = [];
|
|
32 |
$state_markup_tokens = []; |
|
33 | 33 |
foreach ($taxon_nodes as $taxon_node){ |
34 |
$enabled_states = []; |
|
35 |
if($taxon_node->excluded === TRUE){ |
|
36 |
$enabled_states[] = t('excluded'); |
|
37 |
} |
|
38 |
if($taxon_node->doubtful === TRUE){ |
|
39 |
$enabled_states[] = t('doubtful'); |
|
40 |
} |
|
41 |
if($taxon_node->unplaced === TRUE){ |
|
42 |
$enabled_states[] = t('unplaced'); |
|
43 |
} |
|
44 |
if(count($enabled_states) > 0){ |
|
45 |
$label_plural |= count($enabled_states) > 1; |
|
34 |
if(isset($taxon_node->status)){ |
|
35 |
$state_label = strtolower($taxon_node->status); |
|
46 | 36 |
$classification_markup = ' <span class="' . html_class_attribute_ref($taxon_node->classification) .'">[' . $taxon_node->classification->titleCache . ']</span>'; |
47 |
$states_markup = '<span class="' . html_class_attribute_ref($taxon_node) .'">' . join(', ', $enabled_states) . '%s</span>'; // %s will be replaced by the $classification_markup or by '' |
|
48 |
|
|
49 |
$states_markup_tokens[] = [ |
|
50 |
'states' => $states_markup, |
|
37 |
$state_markup = '<span class="' . html_class_attribute_ref($taxon_node) .'">' . $state_label . '%s</span>'; // %s will be replaced by the $classification_markup or by '' |
|
38 |
$state_markup_tokens[] = [ |
|
39 |
'states' => $state_markup, |
|
51 | 40 |
'classification' => $classification_markup, |
52 | 41 |
'closing_tag' => '</span>' |
53 | 42 |
]; |
54 | 43 |
} |
55 | 44 |
} |
56 |
if(count($states_markup_tokens) > 0){
|
|
57 |
$states_markup = [];
|
|
58 |
$label_plural |= count($states_markup_tokens) > 1;
|
|
45 |
if(count($state_markup_tokens) > 0){ |
|
46 |
$state_markup = []; |
|
47 |
$label_plural |= count($state_markup_tokens) > 1; |
|
59 | 48 |
$label = $label_plural ? t('Classificatorical states') : t('Classificatorical state'); |
60 |
if(count($states_markup_tokens) > 1){
|
|
61 |
foreach ($states_markup_tokens as $tokes){
|
|
62 |
$states_markup[] = sprintf($tokes['states'], $tokes['classification']);
|
|
49 |
if(count($state_markup_tokens) > 1){ |
|
50 |
foreach ($state_markup_tokens as $tokes){ |
|
51 |
$state_markup[] = sprintf($tokes['states'], $tokes['classification']); |
|
63 | 52 |
} |
64 | 53 |
} else { |
65 |
foreach ($states_markup_tokens as $tokes){
|
|
66 |
$states_markup[] = sprintf($tokes['states'], '');
|
|
54 |
foreach ($state_markup_tokens as $tokes){ |
|
55 |
$state_markup[] = sprintf($tokes['states'], ''); |
|
67 | 56 |
} |
68 | 57 |
} |
69 |
$render_array['taxon-node-status'] = markup_to_render_array($label . ': ' . join('; ', $states_markup));
|
|
58 |
$render_array['taxon-node-status'] = markup_to_render_array($label . ': ' . join('; ', $state_markup)); |
|
70 | 59 |
$render_array['taxon-node-status']['#prefix'] = '<div class="taxon-node-status">'; |
71 | 60 |
$render_array['taxon-node-status']['#suffix'] = '</div>'; |
72 | 61 |
} |
Also available in: Unified diff
ref #9010 taxon node status display - adaptiong code to model change