diff --git a/library/Controller/Archive.php b/library/Controller/Archive.php index e34bafa47..eea89dc28 100644 --- a/library/Controller/Archive.php +++ b/library/Controller/Archive.php @@ -126,7 +126,12 @@ public function getCurrentTermColour() return false; } - return \Municipio\Helper\Term::getTermColor($term->term_id, $term->taxonomy); + $termHelper = new \Municipio\Helper\Term\Term( + \Municipio\Helper\WpService::get(), + \Municipio\Helper\AcfService::get() + ); + + return $termHelper->getTermColor($term->term_id, $term->taxonomy); } /** @@ -144,7 +149,12 @@ public function getCurrentTermIcon() return false; } - return \Municipio\Helper\Term::getTermIcon($term->term_id, $term->taxonomy); + $termHelper = new \Municipio\Helper\Term\Term( + \Municipio\Helper\WpService::get(), + \Municipio\Helper\AcfService::get() + ); + + return $termHelper->getTermIcon($term->term_id, $term->taxonomy); } /** diff --git a/library/Helper/Listing.php b/library/Helper/Listing.php index b59c89438..f724ea981 100644 --- a/library/Helper/Listing.php +++ b/library/Helper/Listing.php @@ -52,7 +52,13 @@ public static function getTermsWithIcon(array $termIds = []) if (!$term || is_wp_error($term)) { continue; } - $term->icon = \Municipio\Helper\Term::getTermIcon($term); + + $termHelper = new \Municipio\Helper\Term\Term( + \Municipio\Helper\WpService::get(), + \Municipio\Helper\AcfService::get() + ); + + $term->icon = $termHelper->getTermIcon($term); $terms[] = $term; } return $terms; diff --git a/library/Helper/Post.php b/library/Helper/Post.php index 429e86cbd..5adba1b36 100644 --- a/library/Helper/Post.php +++ b/library/Helper/Post.php @@ -456,16 +456,17 @@ private static function getPostExcerpt($postObject): array private static function getPostTermIcon($postId, $postType) { $taxonomies = get_object_taxonomies($postType); + $termIcon = []; + $termColor = false; + $termHelper = new \Municipio\Helper\Term\Term(\Municipio\Helper\WpService::get(), \Municipio\Helper\AcfService::get()); - $termIcon = []; - $termColor = false; foreach ($taxonomies as $taxonomy) { $terms = get_the_terms($postId, $taxonomy); if (!empty($terms)) { foreach ($terms as $term) { if (empty($termIcon)) { - $icon = \Municipio\Helper\Term::getTermIcon($term, $taxonomy); - $color = \Municipio\Helper\Term::getTermColor($term, $taxonomy); + $icon = $termHelper->getTermIcon($term, $taxonomy); + $color = $termHelper->getTermColor($term, $taxonomy); if (!empty($icon) && !empty($icon['src']) && $icon['type'] == 'icon') { $termIcon['icon'] = $icon['src']; $termIcon['size'] = 'md'; diff --git a/library/PostObject/TermIcon/TryGetTermIcon.php b/library/PostObject/TermIcon/TryGetTermIcon.php index 27b364552..3f6320d8b 100644 --- a/library/PostObject/TermIcon/TryGetTermIcon.php +++ b/library/PostObject/TermIcon/TryGetTermIcon.php @@ -14,8 +14,13 @@ class TryGetTermIcon implements TryGetTermIconInterface */ public function tryGetTermIcon(int $termId, string $taxonomy): ?TermIconInterface { - $icon = \Municipio\Helper\Term::getTermIcon($termId, $taxonomy); - $color = \Municipio\Helper\Term::getTermColor($termId, $taxonomy); + $termHelper = new \Municipio\Helper\Term\Term( + \Municipio\Helper\WpService::get(), + \Municipio\Helper\AcfService::get() + ); + + $icon = $termHelper->getTermIcon($termId, $taxonomy); + $color = $termHelper->getTermColor($termId, $taxonomy); if (!empty($icon) && !empty($icon['src']) && $icon['type'] == 'icon') { return $this->createTermIcon($termId, $icon['src'], $color);