Skip to content

Instantly share code, notes, and snippets.

@labboy0276
Created September 11, 2015 15:43
Show Gist options
  • Save labboy0276/66f165e89d5c150ff677 to your computer and use it in GitHub Desktop.
Save labboy0276/66f165e89d5c150ff677 to your computer and use it in GitHub Desktop.
Change contextual filter to a Select list on Pane
/**
* Implements hook_form_FORMID_alter().
*/
function ccm_publications_form_views_content_views_panes_content_type_edit_form_alter(&$form, &$form_state) {
// Change this out to be a select list.
if (isset($form['arguments']['field_ccm_publication_type_tid'])) {
$v = taxonomy_vocabulary_machine_name_load('ccm_publication_type');
$terms = taxonomy_get_tree($v->vid);
foreach ($terms as $term) {
$vocab[$term->tid] = $term->name;
}
$form['arguments']['field_ccm_publication_type_tid']['#type'] = 'select';
$form['arguments']['field_ccm_publication_type_tid']['#options'] = $vocab;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment