Skip to content
Snippets Groups Projects
Unverified Commit d3c1e1d2 authored by weaver299's avatar weaver299 Committed by GitHub
Browse files

Merge pull request #244 from ASCWebServices/canini

adjusting event and news filter taxonomy dropdowns to use user genera…
parents 3b3ba065 79ff278c
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