Skip to content

Instantly share code, notes, and snippets.

@sminnee
Created October 23, 2018 22:59
Show Gist options
  • Select an option

  • Save sminnee/a02d80b80386c4b7162bdd8d375e3425 to your computer and use it in GitHub Desktop.

Select an option

Save sminnee/a02d80b80386c4b7162bdd8d375e3425 to your computer and use it in GitHub Desktop.
diff --git a/src/Helpers/GazetteFormHelper.php b/src/Helpers/GazetteFormHelper.php
index d33c9f9..3159c46 100644
--- a/src/Helpers/GazetteFormHelper.php
+++ b/src/Helpers/GazetteFormHelper.php
@@ -38,9 +38,7 @@ class GazetteFormHelper
public static function getSingleTaxonomyListbox($taxonomyTerm, $label, $depth = null)
{
// Get the parent taxonomy term and its subtree
- $term = TaxonomyTerm::get()->filter([
- 'Name' => $taxonomyTerm
- ])->first();
+ $term = GazetteTaxonomyTermExtension::getTaxonomyByName($taxonomyTerm);
$subtree = $term ? $term->getSubtree(false, $depth, null, true) : null;
@@ -61,6 +59,7 @@ class GazetteFormHelper
/**
* Append a new taxonomy onto the end of a listbox.
+ * NOTE: This appears to be unused now.
*
* @param ListboxField $listbox The Listbox to which the new term will
* appended to
@@ -105,9 +104,7 @@ class GazetteFormHelper
$tree = new ArrayList();
foreach ($taxonomyTerms as $taxonomyTerm) {
- $term = TaxonomyTerm::get()->filter([
- 'Name' => $taxonomyTerm
- ])->first();
+ $term = GazetteTaxonomyTermExtension::getTaxonomyByName($taxonomyTerm);
if ($term) {
$subtree = $term->getSubtree(true, null, null, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment