Score:0

How to hide terms from entity reference field on node form

bw flag

I've been searching quite a bit on this already and was not able to find a solution. installation is d10 So on my node I have an entity reference field which is showing Taxonomy terms. Two of those taxonomy terms should always be hidden on the node form. But they should exist as taxonomy terms, so removing them from the taxonomy is not an option. I tried using hook_form_alter() and unsetting the keys, but that didn't work.

Anyone has experience with this?

Thanks in advance!

Web Assistant avatar
cn flag
I'm wondering if you could use a Views entity reference with a filter to get what you want, then choose that View in the Term entity reference field settings
arnemichiels avatar
bw flag
@WebAssistant That would be a solution, I will try this.
arnemichiels avatar
bw flag
@WebAssistant Hey I just tested that, and that works fine. Thanks!
Score:1
bw flag

@WebAssistant 's answer:

create an Entity Reference View and use a filter to remove the unwanted terms. In the settings of the reference field on the node choose: Views: filter by an entity reference view. Choose the view you created and voila.

I sit in a Tesla and translated this thread with Ai:

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.