synonyms.api.php 1.2 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * @file
  4. * Documentation for Synonyms module.
  5. */
  6. /**
  7. * Hook to alter known simple field types that contain potential synonyms data.
  8. *
  9. * The simple field types (those defined by $map) are used for synonyms
  10. * providing through Drupal\synonyms\Plugin\Synonyms\Provider\Field or
  11. * Drupal\synonyms\Plugin\Synonyms\Provider\BaseField plugins depending whether
  12. * it is an attached field or base one correspondingly. Both synonyms providers
  13. * plugin simply take a specific column/value from the field and return it as a
  14. * synonym.
  15. *
  16. * @param array $map
  17. * Array of known simple field types eligible for synonyms providing through
  18. * the 2 plugins. Keys are field types whereas corresponding values are field
  19. * columns that contain synonyms. You are encouraged to alter $map in order to
  20. * add/remove known field types per your business needs
  21. */
  22. function hook_synonyms_field_type_to_synonym_alter(&$map) {
  23. // Let's assume our module provides some additional field type and we want
  24. // that field type to be eligible for synonyms providing through the 2 simple
  25. // plugins. And let's suppose the synonyms are actually stored in 'value'
  26. // column within our custom field type.
  27. $map['the_field_type_my_module_provides'] = 'value';
  28. }