Revision bb93d5d1
Added by Andreas Kohlbecker almost 5 years ago
modules/cdm_dataportal/includes/common.inc | ||
---|---|---|
81 | 81 |
* |
82 | 82 |
* @param array $sources |
83 | 83 |
* The array of CDM IdentifiableSource instances |
84 |
* @param bool $do_theme if set TRUE the sources will be themed |
|
85 |
* by theme_cdm_OriginalSource |
|
86 |
* @return multitype: |
|
84 |
* @return array |
|
85 |
* An array of drupal render arrays |
|
87 | 86 |
*/ |
88 |
function oder_sources($sources, $do_theme = false){
|
|
87 |
function oder_and_render_original_sources($sources){
|
|
89 | 88 |
$sort_array = array(); |
90 | 89 |
foreach ($sources as $source) { |
91 | 90 |
|
... | ... | |
130 | 129 |
$order_key .= "_"; |
131 | 130 |
} |
132 | 131 |
|
133 |
|
|
134 |
if($do_theme) { |
|
135 |
$sort_array[$order_key] = theme('cdm_OriginalSource', array('source' => $source)); |
|
136 |
} else { |
|
137 |
$sort_array[$order_key] = $source; |
|
138 |
} |
|
132 |
$sort_array[$order_key] = render_original_source($source); |
|
139 | 133 |
} |
140 | 134 |
ksort($sort_array); |
141 | 135 |
return array_values ($sort_array); |
... | ... | |
144 | 138 |
/** |
145 | 139 |
* Compare callback to be used in usort to sort image sources of CDM OriginalSource instances. |
146 | 140 |
* |
147 |
* TODO the compare strategy implemented in oder_sources() is probably better but is not taking the |
|
141 |
* TODO the compare strategy implemented in oder_and_render_original_sources() is probably better but is not taking the
|
|
148 | 142 |
* originalName into account. |
149 | 143 |
* |
150 | 144 |
* @param $a |
Also available in: Unified diff
ref #6316 refactoring for cleaner original source code