Project

General

Profile

« Previous | Next » 

Revision d8069342

Added by Andreas Kohlbecker over 2 years ago

ref #8543 further harmonizing footnote functions

View differences:

modules/cdm_dataportal/includes/footnotes.inc
49 49
 *    Put source references into the bibliography when this param is TRUE.
50 50
 *
51 51
 * @return String
52
 *   The foot note keys
52
 *   The foot note keys as markup
53 53
 *
54 54
 * @throws \Exception re-throw exception from theme()
55 55
 * @see cdm_entities_annotations_footnote_keys()
......
58 58
 * @$original_source_footnote_tag
59 59
 *    null will cause bibliography_footnote_list_key to use the default
60 60
 */
61
function cdm_entity_footnotes(
61
function render_entity_footnotes(
62 62
  $cdm_entity,
63 63
  $separator = ',',
64 64
  $footnote_list_key_suggestion = null,
......
104 104
  }
105 105
  // Sort and render footnote keys.
106 106
  asort($footnote_keys);
107
  return footnote_keys_to_markup($footnote_keys, $separator);
107
  return render_footnote_keys($footnote_keys, $separator);
108 108
}
109 109

  
110 110
/**
......
152 152

  
153 153
  $foot_note_keys = [];
154 154

  
155
  // Getting the key for the footnotemanager.
155
  // Getting the key for the FootnoteManager.
156 156
  if (isset($footnote_list_key_suggestion)) {
157 157
    $footnote_list_key = $footnote_list_key_suggestion;
158 158
  } else {
......
170 170
  return $foot_note_keys;
171 171
}
172 172

  
173
/**
174
 * Created and registers footnotes in the FootnoteManager and returns the
175
 * footnote keys as markup.
176
 *
177
 * The following cdm cdm classes are annotatable:
178
 *
179
 * - DescriptionElementBase
180
 * - EventBase
181
 * - HomotypicalGroup
182
 * - IdentifiableEntity
183
 * - DescriptionBase
184
 * - IdentifiableMediaEntity
185
 * - Media
186
 * - Sequence
187
 * - TaxonBase
188
 * - TaxonName
189
 * - TaxonomicTree
190
 * - TermBase
191
 * - LanguageStringBase
192
 * - ReferencedEntityBase
193
 * - NomenclaturalStatus
194
 * - OriginalSourceBase
195
 * - RelationshipBase
196
 * - TypeDesignationBase
197
 * - TaxonNode
198
 * - WorkingSet
199
 *
200
 * @param array $cdm_entities
201
 *   An array of CdmBase instances.
202
 * @param $footnote_list_key_suggestion string
203
 *    optional parameter. If this parameter is left empty (null, 0, "") the
204
 *   footnote key will be determined be set to
205
 *   RenderHints::getFootnoteListKey().FOOTNOTE_KEY_SUFFIX_ANNOTATIONS otherwise the supplied
206
 *   key will be used.
207
 *
208
 * @return string
209
 *   The markup.
210
 */
211
function render_entities_annotations_as_footnote_keys(array $cdm_entities, $footnote_list_key =null){
212

  
213
  // check if footnotes for annotations are disabled completely
214
  if (variable_get('cdm_dataportal_annotations_footnotes', CDM_DATAPORTAL_ALL_FOOTNOTES)) {
215
    return '';
216
  }
217
  $markup = '';
218
  $footNoteKeys = cdm_entities_annotations_footnote_keys($cdm_entities, $footnote_list_key);
219
  foreach ($footNoteKeys as $a) {
220
    $markup .= render_footnote_key($a, ($markup ? ',' : ''));
221
  }
222
  return $markup;
223
}
224

  
173 225
/**
174 226
 * Creates markup for an array of foot note keys
175 227
 *
......
178 230
 *
179 231
 * @return string
180 232
 */
181
function footnote_keys_to_markup(array $footnote_keys, $separator) {
233
function render_footnote_keys(array $footnote_keys, $separator) {
182 234

  
183 235
  $footnotes_markup = '';
184 236
  foreach ($footnote_keys as $foot_note_key) {
185 237
    try {
186
      $footnotes_markup .= cdm_footnote_key($foot_note_key, ($footnotes_markup ? $separator : ''));
238
      $footnotes_markup .= render_footnote_key($foot_note_key, ($footnotes_markup ? $separator : ''));
187 239
    } catch (Exception $e) {
188 240
      drupal_set_message("Exception: " . $e->getMessage(), 'error');
189 241
    }
......
202 254
 * @return string
203 255
 * @throws \Exception
204 256
 */
205
function cdm_annotation_footnotes($footnote_list_key = null, $element_tag = 'span') {
257
function render_annotation_footnotes($footnote_list_key = null, $element_tag = 'span') {
206 258
  if (variable_get('cdm_dataportal_annotations_footnotes', CDM_DATAPORTAL_ALL_FOOTNOTES)) {
207 259
    return '';
208 260
  }
209
  return cdm_footnotes($footnote_list_key . FOOTNOTE_KEY_SUFFIX_ANNOTATIONS, $element_tag);
261
  return render_footnotes($footnote_list_key . FOOTNOTE_KEY_SUFFIX_ANNOTATIONS, $element_tag);
210 262
}
211 263

  
212 264
/**
......
219 271
 * @return string
220 272
 *   The footnote key markup
221 273
 */
222
function cdm_footnote_key($footnoteKey = null, $separator = '', $separator_off = false) {
274
function render_footnote_key($footnoteKey = null, $separator = '', $separator_off = false) {
223 275

  
224 276
  if (!is_object($footnoteKey) or !isset($footnoteKey->footnoteListKey)) {
225 277
    return '';
......
244 296
 *
245 297
 * @return string
246 298
 */
247
function footnote_markup($footnoteKey = null, $footnoteText = null, $enclosing_tag = 'span') {
299
function render_footnote($footnoteKey = null, $footnoteText = null, $enclosing_tag = 'span') {
248 300
  _add_js_footnotes();
249 301
  if($enclosing_tag == null){
250 302
    $enclosing_tag = 'span';
......
267 319
 *
268 320
 * @return string
269 321
 */
270
function cdm_footnotes($footnote_list_key = null, $element_tag = 'span') {
322
function render_footnotes($footnote_list_key = null, $element_tag = 'span') {
271 323

  
272 324
  if (variable_get('cdm_dataportal_all_footnotes', CDM_DATAPORTAL_ALL_FOOTNOTES)) {
273 325
    return '';

Also available in: Unified diff