I'm working on a project with this requirement: there will be a couple of custom content types where many fields comes from taxonomies references.
Many of these taxonomies have plenty of terms (50+). These terms are periodically updated (added/corrected/removed) by a third party system in charge of this task, which later exposes these 'most current' terms list through a webservice.
So I don't need to force a human operator to manually check these terms lists and update D8 taxonomies accordingly, I thing that a good approach would be to periodically run a task to verify that webservice and then updated D8 with what have changed.
I've carefully read the following references:
Programmatically create term in Drupal 8?
Programmatically create a term?
Create taxonomy term programmatically on Drupal 8
Drupal 8 - Examples - create_taxonomy_term.php
Saving and retrieving taxonomy terms programmatically for Drupal 8
The one that come closer to the project needs is the 4th one in the above list. It would suffice the requirements for now.
But I didn't quite get where this code should be typed. Does it need to be a custom module or should it go into
themes/mytheme/mytheme.theme or so?
From where I stand, I think that an elegant solution is to have a routine somewhere (where?) that I could call via D8's cron so I can retrieve-then-update taxonomies periodically. But I have no clue on how I could achieve that goal.
Can someone provide any good references so I can fulfill this desire with code?