Score:2

Add an image to a vocabulary

cn flag

I need to add an image to a vocabulary, not the taxonomy terms. Essentially, I need to add a field to the "Edit Vocabulary" page.

Is there a way to do this?

in flag
Have you tried replacing/overriding `Drupal\taxonomy\Drupal\taxonomy\VocabularyForm`, or implementing `hook_form_alter()`?
xpersonas avatar
cn flag
I haven't. I know what you mean. I guess my question would be, after altering the form then adding a field, where is it going to be stored?
in flag
Depending on your use case, you could just use a single configuration object to store all VID:FID relationships, or one config object per vocab, if that suits your needs better. You could could also get creative, using plugins and a deriver, or define a very simple entity type just for VID companion images. It all depends on your use case and requirements. All things being equal, I would probably just use a single configuration object.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.