Skip to content

Instantly share code, notes, and snippets.

@adrexia
Last active December 16, 2015 22:19
Show Gist options
  • Save adrexia/5506147 to your computer and use it in GitHub Desktop.
Save adrexia/5506147 to your computer and use it in GitHub Desktop.
Replace taxonomy GridField with ListboxField
$fields->removeByName("Tags");
$taxonomyMap = TaxonomyTerm::get()->map("ID", "Name")->toArray();
asort($taxonomyMap);
$taxonomy = ListboxField::create('Terms', singleton('TaxonomyTerm')->i18n_plural_name())
->setMultiple(true)
->setSource($taxonomyMap)
->setAttribute(
'data-placeholder',
_t('Member.Tags', 'Tags', 'Placeholder text for a dropdown'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment