Project

General

Profile

« Previous | Next » 

Revision 1cda248c

Added by Andreas Kohlbecker over 5 years ago

fix #7438 secReference optional in separate line above accepted taxon

View differences:

modules/cdm_dataportal/cdm_dataportal.css
243 243
 * ======= synonymy =======
244 244
 */
245 245

  
246
#synonymy .secReference {
247
    margin-bottom: 0.5em;
248
}
249

  
246 250
#synonymy ul {
247 251
    margin: 0;
248 252
}
modules/cdm_dataportal/includes/pages.inc
645 645
    }
646 646
    $addAcceptedTaxon = variable_get('cdm_dataportal_nomref_in_title', CDM_DATAPORTAL_NOMREF_IN_TITLE);
647 647

  
648
    $synonymy_html .= theme('cdm_taxon_page_synonymy', array('taxon' => $taxon, 'addAcceptedTaxon' => $addAcceptedTaxon));
648
    $synonym_a = compose_cdm_taxon_page_synonymy($taxon, $addAcceptedTaxon);
649
    $synonymy_html .= drupal_render($synonym_a);
649 650

  
650 651
    $synonymy_html .= '</div>';
651 652
    $render_array['synonymy'] = markup_to_render_array($synonymy_html, $weight++);
......
849 850
  }
850 851

  
851 852
  if($add_synonymy){
852
    $render_array['synonymy'] = markup_to_render_array(
853
      theme('cdm_taxon_page_synonymy', array('taxon' => $taxon, 'addAcceptedTaxon' => true)),
854
      -102
855
    );
853
    $synonymy_a = compose_cdm_taxon_page_synonymy($taxon, true);
854
    $synonymy_a['#weight'] = -102;
855
    $render_array['synonymy'] = $synonymy_a;
856 856
  }
857 857

  
858 858
  $pseudo_feature_blocks = array();
modules/cdm_dataportal/settings.php
27 27
  define('CDM_DATAPORTAL_COMPRESSED_SPECIMEN_DERIVATE_TABLE_PAGE_SIZE', 50);
28 28
  define('CDM_DATAPORTAL_COMPRESSED_SPECIMEN_DERIVATE_TABLE_SHOW_DETERMINED_AS', 0);
29 29
  define('CDM_DATAPORTAL_DISPLAY_IS_ACCEPTED_FOR', 0);
30
  define('CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE', 'cdm_synonymy_accepted_taxon_sec_separate');
31
  define('CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL', 'cdm_synonymy_accepted_taxon_sec_separate_label');
32
  define('CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL_DEFAULT', 'Source');
30 33
  define('CDM_DATAPORTAL_ALL_FOOTNOTES', 0);
31 34
  define('CDM_DATAPORTAL_ANNOTATIONS_FOOTNOTES', 0);
32 35
  define('CDM_DATAPORTAL_LAST_VISITED_TAB_ARRAY_INDEX', 999);
......
2474 2477

  
2475 2478
  $form['taxon_synonymy']['cdm_dataportal_nomref_in_title'] = array(
2476 2479
    '#type' => 'checkbox',
2477
    '#title' => t('Show accepted taxon on top of the synonymy'),
2480
    '#title' => t('Accepted taxon on top of the synonymy'),
2478 2481
    '#default_value' => variable_get('cdm_dataportal_nomref_in_title', CDM_DATAPORTAL_NOMREF_IN_TITLE),
2479 2482
    '#description' => t('If checked, the first homotypic taxon is a repetition
2480
      of the accepted taxon most likely with the full nomenclatural reference
2481
      (depending on the currently chosen theme).'),
2483
      of the accepted taxon most likely with the full nomenclatural reference, 
2484
      depending on the ' . l('Name render templates', 'admin/config/cdm_dataportal/settings/layout') . '.'),
2482 2485
  );
2483 2486

  
2487
  $form['taxon_synonymy'][CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE] = array(
2488
    '#type' => 'checkbox',
2489
    '#title' => t('Secundum referenence as separate line above the accepted taxon.'),
2490
    '#default_value' => variable_get(CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE, 0),
2491
    '#description' => t('You may want to remove the <code>"secReferencePart": true,</code> entry from <code>"accepted_taxon.taxon_page_synonymy"{</code> the in the '
2492
      . l('Name render templates', 'admin/config/cdm_dataportal/settings/layout')
2493
      . ' (Only applicable when the "Show accepted taxon on top of the synonymy" option above is enabled.)'),
2494
    '#disabled' =>  !variable_get('cdm_dataportal_nomref_in_title', CDM_DATAPORTAL_NOMREF_IN_TITLE)
2495
  );
2496

  
2497
  $form['taxon_synonymy'][CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL] = array(
2498
    '#type' => 'textfield',
2499
    '#description' => 'Label for the secundum referenence.',
2500
    '#default_value' => variable_get(CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL, CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL_DEFAULT),
2501
    '#disabled' =>  !variable_get('cdm_dataportal_nomref_in_title', 0)
2502
    );
2503

  
2484 2504
  $form['taxon_synonymy']['cdm_dataportal_display_is_accepted_for'] = array(
2485 2505
    '#type' => 'checkbox',
2486 2506
    '#title' => t('Display <em>is accepted for ...</em> on taxon pages when
modules/cdm_dataportal/theme/cdm_dataportal.page.theme
137 137
 * The synonymy list is headed by the complete scientific name
138 138
 * of the accepted taxon with nomenclatural reference.
139 139
 *
140
 * @param array $variables
141
 *   An associative array containing:
142
 *   - taxon
143
 *   - addAcceptedTaxon
140
 * @param object $taxon
141
 * @param boolean $add_accepted_taxon
144 142
 *
145
 * @return string
146
 *  Markup for the synonymy
143
 * @return array
144
 *  Drupal render array for the synonymy
147 145
 *
148 146
 * @throws Exception
149 147
 *
150
 * @ingroup themeable
148
 * @ingroup compose
151 149
 */
152
function theme_cdm_taxon_page_synonymy($variables) {
153
  $taxon = $variables['taxon'];
154
  $addAcceptedTaxon = $variables['addAcceptedTaxon'];
150
function compose_cdm_taxon_page_synonymy($taxon, $add_accepted_taxon) {
155 151

  
156 152
  RenderHints::pushToRenderStack('taxon_page_synonymy');
157 153

  
......
169 165
  // even if there are not synonyms in the homotypic group
170 166
  // homotypic group and accepted taxon should have the same footnote key
171 167
  $referenceUri = '';
172
  if ($addAcceptedTaxon) {
168
  if ($add_accepted_taxon) {
173 169
    // remember the last part of the render path
174 170
    $synonymy_render_path = RenderHints::getRenderPath();
175 171
    // set new render path for the accepted taxon so
176 172
    // it can be styled differently via the name render part definitions
177 173
    RenderHints::pushToRenderStack('accepted_taxon');
174
    $accepted_name = '';
175
    if (variable_get(CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE, 0)) {
176
      $label = variable_get(CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL, CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL_DEFAULT);
177
      $accepted_name .= '<div class="secReference"><span class="label">' . t($label) . ':</span> ' . $taxon->sec->titleCache . '</div>';
178
    }
178 179
    if (isset($taxon->name->nomenclaturalReference)) {
179 180
      $referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
180 181
    }
181 182

  
182
    $accepted_name = '<div class="accepted-name">';
183
    $accepted_name .= '<div class="accepted-name">';
183 184
    $accepted_name .= render_taxon_or_name($taxon, NULL, $referenceUri);
184 185

  
185 186
    $name_relationships = cdm_name_relationships_of($taxon);
......
230 231

  
231 232
  RenderHints::popFromRenderStack();
232 233

  
233
  return $out;
234
  return markup_to_render_array($out);
234 235
}
235 236

  
236 237

  
modules/cdm_dataportal/theme/theme_registry.inc
106 106
    'cdm_specimen_page_title' => array('variables' => array('specimen' => NULL)),
107 107
    'cdm_taxon_page_title' => array('variables' => array('taxon' => NULL)),
108 108
    'cdm_name_page_title' => array('variables' => array('taxon_name' => NULL)),
109
    'cdm_taxon_page_synonymy' => array('variables' => array('taxon' => NULL, 'addAcceptedTaxon' => NULL)),
110 109
    'cdm_media_page' => array('variables' => array(
111 110
        'media' => NULL,
112 111
        'mediarepresentation_uuid' => FALSE,

Also available in: Unified diff