Project

General

Profile

« Previous | Next » 

Revision d0d0a092

Added by Andreas Kohlbecker over 3 years ago

ref #8543 complete removal of annotation footnote code, also removing deprecated methods

View differences:

modules/cdm_dataportal/cdm_dataportal.module
2132 2132
      }
2133 2133
    }
2134 2134

  
2135
    $content['footnotes'] = markup_to_render_array(render_footnotes_annotation_and_sources());
2135
    $content['footnotes'] = markup_to_render_array(render_footnotes());
2136 2136

  
2137 2137
    $taxon_name_page->content = $content;
2138 2138
    RenderHints::popFromRenderStack();
modules/cdm_dataportal/includes/descriptions.inc
735 735
             */
736 736
            $block->content[] = markup_to_render_array(render_footnotes(PSEUDO_FEATURE_BIBLIOGRAPHY . '-' . $feature_node->term->uuid));
737 737
            $block->content[] = markup_to_render_array(render_footnotes($feature_node->term->uuid));
738
            $block->content[] = markup_to_render_array(render_annotation_footnotes($feature_node->term->uuid));
739 738
          }
740 739
        } // END all other features
741 740

  
......
1034 1033

  
1035 1034
    $block->content[] = markup_to_render_array(render_footnotes('BIBLIOGRAPHY-' . UUID_DISTRIBUTION));
1036 1035
    $block->content[] = markup_to_render_array(render_footnotes(UUID_DISTRIBUTION));
1037
    $block->content[] = markup_to_render_array(render_annotation_footnotes(UUID_DISTRIBUTION));
1038 1036

  
1039 1037
    return $block;
1040 1038
  }
......
1657 1655
  );
1658 1656

  
1659 1657
  $footnotes = render_footnotes('BIBLIOGRAPHY-' . $footnote_key_suggestion);
1660
  $footnotes .= render_footnotes($footnote_key_suggestion); // FIXME is this needed at all?
1661
  $footnotes .= render_annotation_footnotes($footnote_key_suggestion);
1658
  $footnotes .= render_footnotes($footnote_key_suggestion);
1662 1659

  
1663 1660
  return  markup_to_render_array(  // FIXME markup_to_render_array should no longer be needed
1664 1661
    '<div class="common-taxon-name">' . $common_name_out . '</div>'
modules/cdm_dataportal/includes/footnotes.inc
15 15
 * @author
16 16
 *   - Andreas Kohlbecker <a.kohlbecker@BGBM.org>
17 17
 */
18
const FOOTNOTE_KEY_SUFFIX_ANNOTATIONS = '-annotations';
19 18

  
20 19
/**
21 20
 * Creates the footnotes for the given CDM instance.
......
24 23
 * parameters $footnote_list_key_suggestion and $is_bibliography_aware, see parameter $footnote_list_key_suggestion
25 24
 * for more details.
26 25
 *
27
 * possible keys for
28
 *     - annotation footnotes:
26
 * possible keys for annotation and source footnotes:
29 27
 *       - $footnote_list_key_suggestion
30
 *       - RenderHints::getFootnoteListKey().FOOTNOTE_KEY_SUFFIX_ANNOTATIONS
28
 *       - RenderHints::getFootnoteListKey()
31 29
 *     - original source footnotes
32 30
 *       - "BIBLIOGRAPHY" (when !$is_bibliography_aware && bibliography_settings['enabled'] == 1 )
33 31
 *       - "BIBLIOGRAPHY-$footnote_list_key_suggestion" (when !$is_bibliography_aware && bibliography_settings['enabled'] == 0 )
......
39 37
 *   Optional parameter. The separator string to concatenate the footnote ids, default is ','
40 38
 * @param $footnote_list_key_suggestion string
41 39
 *    Optional parameter. If this parameter is left empty (null, 0, "") the footnote key will be determined by the nested
42
 *    method calls by calling RenderHints::getFootnoteListKey(). NOTE: the footnote key for annotations will be set to
43
 *    RenderHints::getFootnoteListKey().'-annotations'.
40
 *    method calls by calling RenderHints::getFootnoteListKey().
44 41
 *    For original sources the $footnote_list_key_suggestion will be overwritten by bibliography_footnote_list_key() when
45 42
 *    $is_bibliography_aware is set TRUE.
46 43
 * @param bool $do_link_to_reference
......
107 104
}
108 105

  
109 106
/**
110
 * Fetches the list of visible annotations for each of the cdm entities and returns the footnote keys for them.
111
 *
112
 * The footnotes are passed to the FootnoteManager in order to store the annotations and to create the footnote keys.
113
 *
114
 * @see cdm_fetch_visible_annotations()
115
 *
116
 * @param array $cdm_entities
117
 *   An array of CdmBase instances.
118
 * @param $footnote_list_key_suggestion string
119
 *    optional parameter. If this parameter is left empty (null, 0, "") the footnote key will be determined be set to
120
 *    RenderHints::getFootnoteListKey().FOOTNOTE_KEY_SUFFIX_ANNOTATIONS otherwise the supplied key will be used.
121
 *
122
 * @return array of footnote keys
123
 *
124
 * @deprecated unused, needs to be removed
125
 */
126
function cdm_entities_annotations_footnote_keys(array $cdm_entities, $footnote_list_key_suggestion = NULL) {
127

  
128
  $foot_note_keys = [];
129
  foreach ($cdm_entities as $cdm_entity) {
130
    $foot_note_keys = array_merge($foot_note_keys, cdm_entity_annotations_as_footnote_keys($cdm_entity,$footnote_list_key_suggestion));
131
  }
132

  
133
  return $foot_note_keys;
134
}
135

  
136
/**
137 107
 * Fetches the list of visible annotations for the cdm entity or for the comparable
138 108
 * object and returns the footnote keys.
139 109
 *
......
142 112

  
143 113
 * @param stdClass $cdm_entity
144 114
 *   A single CdmBase instance ore comparable object.
145
 * @param $footnote_list_key_suggestion string
146
 *    optional parameter. If this parameter is left empty (null, 0, "") the footnote key will be determined be set to
147
 *    RenderHints::getFootnoteListKey().'-annotations' otherwise the supplied key will be used.
115
 * @param $footnote_list_key string
116
 *    optional parameter. If this parameter is left empty (null, 0, "") the
117
 *    footnote key will be set to RenderHints::getFootnoteListKey()
118
 *    otherwise the supplied $footnote_list_key will be used.
148 119
 * @return array of footnote keys
149 120
 *
150 121
 * @see cdm_fetch_visible_annotations()
151 122
 */
152
function cdm_entity_annotations_as_footnote_keys(stdClass $cdm_entity, $footnote_list_key_suggestion = NULL) {
123
function cdm_entity_annotations_as_footnote_keys(stdClass $cdm_entity, $footnote_list_key = NULL) {
153 124

  
154 125
  $foot_note_keys = [];
155 126

  
156
  // Getting the key for the FootnoteManager.
157
  if (isset($footnote_list_key_suggestion)) {
158
    $footnote_list_key = $footnote_list_key_suggestion;
159
  } else {
160
    $footnote_list_key = RenderHints::getFootnoteListKey() . FOOTNOTE_KEY_SUFFIX_ANNOTATIONS;
161
    throw new Exception("FOOTNOTE_KEY_SUFFIX_ANNOTATIONS");
127
  if (!isset($footnote_list_key) || !$footnote_list_key) {
128
    $footnote_list_key = RenderHints::getFootnoteListKey();
162 129
  }
163 130

  
164 131
  // Adding the footnotes keys.
......
173 140
}
174 141

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

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

  
228
/**
229 143
 * Creates markup for an array of foot note keys
230 144
 *
231 145
 * @param array $footnote_keys
......
247 161
}
248 162

  
249 163
/**
250
 * Create markup for the footnotes mapped to the $footnoteListKey.
251
 *
252
 * @param null $footnote_list_key
253
 *  The footnote list key, see RenderHints::getFootnoteListKey()
254
 * @param $element_tag
255
 *  The tag for the footnote element
256
 *
257
 * @return string
258
 */
259
function render_annotation_footnotes($footnote_list_key = null, $element_tag = 'span') {
260
  if (variable_get('cdm_dataportal_annotations_footnotes', CDM_DATAPORTAL_ALL_FOOTNOTES)) {
261
    return '';
262
  }
263
  return render_footnotes($footnote_list_key . FOOTNOTE_KEY_SUFFIX_ANNOTATIONS, $element_tag);
264
}
265

  
266
/**
267 164
 * Creates markup for a foot note key
268 165
 *
269 166
 * @param null $footnoteKey
......
336 233
  return $out;
337 234
}
338 235

  
339
/**
340
 * Renders the footnotes for annotations and sources, etc.
341
 *
342
 * @param string $footnote_list_key
343
 *    RenderHints::getFootnoteListKey() will be used if this parameter is undefined.
344
 * @param string $enclosingTag
345
 *    Default tag is 'span'
346
 *
347
 * @return string
348
 *    The markup string
349
 * @deprecated to be replaced by render_footnotes() once FOOTNOTE_KEY_SUFFIX_ANNOTATIONS is no longer used
350
 */
351
function render_footnotes_annotation_and_sources($footnote_list_key = NULL, $enclosingTag = 'span'){
352

  
353
  if (variable_get('cdm_dataportal_all_footnotes', CDM_DATAPORTAL_ALL_FOOTNOTES)) {
354
    return '';
355
  }
356
  if(!$footnote_list_key){
357
    $footnote_list_key = RenderHints::getFootnoteListKey();
358
  }
359

  
360
  $out = '<' . $enclosingTag . ' class="footnotes footnotes-' . $footnote_list_key . ' ">'
361
    . FootnoteManager::renderFootnoteList($footnote_list_key . FOOTNOTE_KEY_SUFFIX_ANNOTATIONS) . ' ' . FootnoteManager::renderFootnoteList($footnote_list_key)
362
    . '</' . $enclosingTag . '>';
363
  FootnoteManager::removeFootnoteList($footnote_list_key . FOOTNOTE_KEY_SUFFIX_ANNOTATIONS);
364
  FootnoteManager::removeFootnoteList($footnote_list_key);
365
  return $out;
366
}
modules/cdm_dataportal/includes/name.inc
701 701
      $render_array['nomenclatural_act']['#weight'] + 10 );
702 702
  }
703 703

  
704
  $render_array['nomenclatural_act']['footnotes'] = markup_to_render_array(render_footnotes_annotation_and_sources(),
704
  $render_array['nomenclatural_act']['footnotes'] = markup_to_render_array(render_footnotes(),
705 705
    100
706 706
  );
707 707

  
modules/cdm_dataportal/includes/taxon.inc
210 210
  }
211 211

  
212 212
  $footnotes = render_footnotes($footnote_list_key, 'li');
213
  $footnotes .= render_annotation_footnotes($footnote_list_key,'li');
214 213

  
215 214
  $out .= '<ul class="footnotes">' . $footnotes . '</ul>';
216 215
  $out .= '</div>';
modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
330 330
    $out .= '</li>';
331 331
  }
332 332
  $out .= '</ul>';
333
  $out .= render_annotation_footnotes(RenderHints::getRenderPath());
333
  $out .= render_footnotes(RenderHints::getRenderPath());
334 334
  RenderHints::popFromRenderStack();
335 335

  
336 336
  return $out;
modules/cdm_dataportal/theme/cdm_dataportal.name.theme
59 59

  
60 60
  // ------- footnotes ------- //
61 61
  $out .= '<ul class="footnotes">';
62
  $out .= render_annotation_footnotes(RenderHints::getFootnoteListKey(), 'li');
63 62
  $out .= render_footnotes(RenderHints::getFootnoteListKey(), 'li');
64 63
  $out .= '</ul>';
65 64

  
......
124 123
  // all foonotes of the homotypic group and also of the accepted taxon are
125 124
  // rendered here, both should have the same footnote key
126 125
  $out .= '<ul class="footnotes">';
127
  $out .= render_annotation_footnotes(RenderHints::getFootnoteListKey(), 'li');
128 126
  $out .= render_footnotes(RenderHints::getFootnoteListKey(), 'li');
129 127
  $out .= '</ul>';
130 128

  

Also available in: Unified diff