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
Comment #2
brooke_heaton commentedAdded 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.
Comment #3
brooke_heaton commentedpatch added.
Comment #4
brooke_heaton commentedChanged placement of the alter function on term creation so that $values can properly be altered before term creation.
Comment #5
karens commentedGood idea but I would use dependency injection. And since we are sending $context, might as well provide whatever other information we can.
Comment #7
karens commented