In our use case, we are creating a Vocabulary of just U.S. States. We actually don't want any cities stored in this vocabulary. While it is possible to hide the locality value in an Address form, we often want to save a city, but only want to taxonomize or associate the entity with a U.S. State.

Adding alter hooks will allow the ability to change the term lookup (to remove the locality or set it to null) in getPlaceTerm and also the ability to alter term creation (to set a parent or other fields) on createTerm.

Comments

brooke_heaton created an issue. See original summary.

brooke_heaton’s picture

Added two moduleHandler alter functions to allow for altering the term lookup and creation. The lookup allows for both $place and $address_field values to be passed in. The term creation alter allows for the $values array to be altered.

brooke_heaton’s picture

Issue summary: View changes
Status: Active » Needs review

patch added.

brooke_heaton’s picture

Changed placement of the alter function on term creation so that $values can properly be altered before term creation.

karens’s picture

Good idea but I would use dependency injection. And since we are sending $context, might as well provide whatever other information we can.

  • KarenS committed 8e36376 on 8.x-1.x authored by brooke_heaton
    Issue #3060798 by brooke_heaton, KarenS: Add alter hooks for altering...
karens’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.