Score:0

How to fetch form values for Simple hierarchical select?

ng flag

I have referenced a field with taxonomy by using simple hierarchical module and now I have to fetch the options programmatically to perform some actions on them. I tried to fetch it like the below it didn't work out.

$form['field_delivery_methods']['widget']['#options'];

This worked on shs 8.x-1.0-alpha5 but after upgrading to shs 2.0.0-rc3 its not working. Does anyone help me in understanding the latest structure on how to fetch the options?

Score:-3
ly flag

You can use field_info_field() or can list_allowed_values().

$field = field_info_field('field_name');
$allowed_values = list_allowed_values($field);
Kevin avatar
in flag
This is a Drupal 9 question. These functions have been deprecated and removed for a long time.
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.