Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi all, I would like ask for how to remove(or hide) some terms from drop box, because I need hide some terms. I thought that I will use mymodule_form_alter(), but when i use dsm($form) in this function there is not list of terms.
I thought that I will use similar code:
global $user;
foreach ($form['taxonomy'] as $vid => $vocabulary) {
if (is_numeric($vid) && private_taxonomy_is_vocabulary_private($vid) && isset($vocabulary['#options'])) {
foreach ($vocabulary['#options'] as $key => $option) {
if (is_numeric($key)) {
foreach ($option->option as $tid => $value) {
if (private_taxonomy_term_get_user($tid)!=$user->uid) {
unset($form['taxonomy'][$vid]['#options'][$key]->option[$tid]);
}
}
}
}
}
}
Thanks for help
Comments
Comment #1
marinex CreditAttribution: marinex commented