0

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?

1 Answer 1

-3

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

$field = field_info_field('field_name');
$allowed_values = list_allowed_values($field);
1
  • 1
    This is a Drupal 9 question. These functions have been deprecated and removed for a long time.
    – Kevin
    Nov 14, 2022 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.