Project

General

Profile

« Previous | Next » 

Revision cd4f8f20

Added by Andreas Kohlbecker almost 5 years ago

fix #5855 improving name relations settings:

  • limiting select options
  • differentiating from releations to be displayed in name page

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
1419 1419

  
1420 1420

  
1421 1421
/**
1422
 * @todo Please document this function.
1423
 * @see http://drupal.org/node/1354
1422
 * Callback function which provides the localized representation of a cdm term.
1423
 *
1424
 * The representation is build by concatenating the abbreviated label with the label
1425
 * and thus is especially useful for relationship terms
1426
 * The localized representation provided by the cdm can be overwritten by
1427
 * providing a drupal translation.
1428
 *
1424 1429
 */
1425 1430
function _cdm_relationship_type_term_label_callback($term) {
1426 1431
  if (isset($term->representation_L10n_abbreviatedLabel)) {
......
1432 1437
  }
1433 1438
}
1434 1439

  
1440
/**
1441
 * Callback function which provides the localized inverse representation of a cdm term.
1442
 *
1443
 * The representation is build by concatenating the abbreviated label with the label
1444
 * and thus is especially useful for relationship terms
1445
 * The localized representation provided by the cdm can be overwritten by
1446
 * providing a drupal translation.
1447
 *
1448
 */
1449
function _cdm_relationship_type_term_inverse_label_callback($term) {
1450
  if (isset($term->inverseRepresentation_L10n_abbreviatedLabel)) {
1451
    return $term->inverseRepresentation_L10n_abbreviatedLabel . ' : '
1452
      . t('@term', array('@term' => $term->inverseRepresentation_L10n));
1453
  }
1454
  else {
1455
    return t('@term', array('@term' => $term->inverseRepresentation_L10n));
1456
  }
1457
}
1458

  
1435 1459
// ========================================================================================== //
1436 1460
/**
1437 1461
 * @todo Improve documentation of this function.
modules/cdm_dataportal/settings.php
2168 2168
      '#collapsible' => TRUE,
2169 2169
      '#collapsed' => FALSE,
2170 2170
      '#description' => 'This section let\'s you define how each of the feature blocks is displayed.
2171
      A sub form is for each of the features of currently selected feature tree allows to configre each feature block individually.
2171
      A sub form for each of the the currently selected feature tree allows to configure each feature block individually.
2172 2172
      The subforms have the following settings in common:<br />
2173 2173
      <h6>List type:</h6><div>Whether the description elements are displayed as list or not. Three different list types are available</div>
2174 2174
      <h6>Link to reference:</h6><div>Render the reference as link, ignored if the element is NOT a DescriptionElementSource</div>
......
2537 2537
      synonym you want to see the "accept of" text for the accepted synonym.'),
2538 2538
  );
2539 2539

  
2540
  /* === currently unused ===
2541
  $nameRelationshipTypeOptions = cdm_vocabulary_as_option(UUID_NAME_RELATIONSHIP_TYPE);
2542
  $form['taxon_synonymy']['name_relationships']['name_relationships_to_show'] = array(
2543
    '#type' => 'checkboxes',
2544
    '#title' => t('Display name relationships') . ':',
2545
    '#default_value' => variable_get('name_relationships_to_show', 0),
2546
    '#options' => $nameRelationshipTypeOptions,
2547
    '#description' => t('Select the name relationships you want to show for the
2548
      accepted taxa.'),
2549
  );
2550
 */
2551

  
2552 2540
  $form['taxon_synonymy']['taxon_relations'] = array(
2553 2541
    '#type' => 'fieldset',
2554 2542
    '#title' => t('Taxon relationships'),
......
2569 2557
  $form['taxon_synonymy']['taxon_relations'][CDM_TAXON_RELATIONSHIP_TYPES] = array(
2570 2558
    '#type' => 'checkboxes',
2571 2559
    '#title' => t('Taxon relationship types') . ':',
2572
    '#description' => t('Only taxon relationships of the selected type will be
2573
      displayed'),
2560
    '#description' => 'Only taxon relationships of the selected type will be displayed',
2574 2561
    '#options' => $taxon_relationship_type_options,
2575 2562
    '#default_value' => $taxon_relationship_type_defaults,
2576 2563
    '#disabled' => !variable_get(CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT),
......
2583 2570
    '#collapsed' => FALSE
2584 2571
  );
2585 2572

  
2586
  $name_relationship_type_options = cdm_vocabulary_as_option(UUID_NAME_RELATIONSHIP_TYPE, '_cdm_relationship_type_term_label_callback');
2573
  $name_relationship_type_options = cdm_vocabulary_as_option(
2574
      UUID_NAME_RELATIONSHIP_TYPE,
2575
      '_cdm_relationship_type_term_inverse_label_callback',
2576
      false,
2577
      array('uuid' => '/' .UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM . '|'
2578
        . UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM . '|'
2579
        . UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR . '/' )
2580
  );
2587 2581
  $form['taxon_synonymy']['name_relations'][CDM_NAME_RELATIONSHIP_TYPES] = array(
2588 2582
    '#type' => 'checkboxes',
2589 2583
    '#title' => t('Name relationship types') . ':',
2590
    '#description' => t('Only name relationships of the selected type will be
2591
      displayed'),
2584
    '#description' => 'This setting only affects specific types of name relations which are displayed appended to scientific name. 
2585
    A full listing of all name relationships for a scientific name is provided by the taxon ' . l('name page', 'admin/config/cdm_dataportal/settings/layout/name-page') . '.',
2592 2586
    '#options' => $name_relationship_type_options,
2593 2587
    '#default_value' => variable_get(CDM_NAME_RELATIONSHIP_TYPES, unserialize(CDM_NAME_RELATIONSHIP_TYPES_DEFAULT)),
2594 2588
  );

Also available in: Unified diff