Skip to content
Snippets Groups Projects
Commit 79ff278c authored by Brian Canini's avatar Brian Canini
Browse files

adjusting event and news filter taxonomy dropdowns to use user generated taxonomy name

parent 3b3ba065
No related branches found
No related tags found
No related merge requests found
......@@ -154,6 +154,34 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
if(count($form['field_evt_taxonomy2_target_id']['#options']) == 1) {
$form['field_evt_taxonomy2_target_id']['#access'] = FALSE;
}
if(isset($form['field_evt_taxonomy_target_id_1']['#options']['All'])) {
$tarr = array_slice(array_keys($form['field_evt_taxonomy_target_id_1']['#options']), 1, 5, true);
$tid = array_shift($tarr);
$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['field_evt_taxonomy_target_id_1']['#options']['All'] = $vocab_label;
}
}
}
if(isset($form['field_evt_taxonomy2_target_id']['#options']['All'])) {
$tarr = array_slice(array_keys($form['field_evt_taxonomy2_target_id']['#options']), 1, 5, true);
$tid = array_shift($tarr);
$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['field_evt_taxonomy2_target_id']['#options']['All'] = $vocab_label;
}
}
}
}
//gallery
......@@ -222,6 +250,35 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
if(count($form['field_news_terms_2_target_id']['#options']) == 1) {
$form['field_news_terms_2_target_id']['#access'] = FALSE;
}
if(isset($form['field_news_terms_1_target_id']['#options']['All'])) {
$tarr = array_slice(array_keys($form['field_news_terms_1_target_id']['#options']), 1, 5, true);
$tid = array_shift($tarr);
$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['field_news_terms_1_target_id']['#options']['All'] = $vocab_label;
}
}
}
if(isset($form['field_news_terms_2_target_id']['#options']['All'])) {
$tarr = array_slice(array_keys($form['field_news_terms_2_target_id']['#options']), 1, 5, true);
$tid = array_shift($tarr);
$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['field_news_terms_2_target_id']['#options']['All'] = $vocab_label;
}
}
}
}
//research filters
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment