diff --git a/web/themes/asc_bootstrap/asc_bootstrap.theme b/web/themes/asc_bootstrap/asc_bootstrap.theme index e25960df08379b34efc532cfa29cdd899c705cdf..dee8ebcc9b9bd3d30d0c69d657e70c1363661619 100755 --- a/web/themes/asc_bootstrap/asc_bootstrap.theme +++ b/web/themes/asc_bootstrap/asc_bootstrap.theme @@ -1,4 +1,7 @@ <?php +use \Drupal\taxonomy\Entity\Term; +use \Drupal\taxonomy\Entity\Vocabulary; + /** * @file * Bootstrap sub-theme. @@ -126,9 +129,52 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $ if(count($form['field_appointment_target_id']['#options']) == 0) { $form['field_appointment_target_id']['#access'] = FALSE; } + else { + $tid = array_shift(array_keys($form['field_appointment_target_id']['#options'])); + $term = Term::load($tid); + if (!empty($term)) { + $vid = array_shift($term->vid->getValue())['target_id']; + if(!empty($vid)) { + $vocab = Vocabulary::load($vid); + $vocab_label = $vocab->get('name'); + $form['#info']['filter-field_appointment_target_id']['label'] = $vocab_label; + } + } + } + if(count($form['field_research_interests_target_id']['#options']) == 0) { $form['field_research_interests_target_id']['#access'] = FALSE; } + else { + $tid = array_shift(array_keys($form['field_research_interests_target_id']['#options'])); + $term = Term::load($tid); + if (!empty($term)) { + $vid = array_shift($term->vid->getValue())['target_id']; + if(!empty($vid)) { + $vocab = Vocabulary::load($vid); + $vocab_label = $vocab->get('name'); + $form['#info']['filter-field_research_interests_target_id']['label'] = $vocab_label; + } + } + } + + + if(count($form['field_other_target_id']['#options']) == 0) { + $form['field_other_target_id']['#access'] = FALSE; + } + else { + $tid = array_shift(array_keys($form['field_other_target_id']['#options'])); + $term = Term::load($tid); + if (!empty($term)) { + $vid = array_shift($term->vid->getValue())['target_id']; + if(!empty($vid)) { + $vocab = Vocabulary::load($vid); + $vocab_label = $vocab->get('name'); + $form['#info']['filter-field_other_target_id']['label'] = $vocab_label; + } + } + } + } /*