You are here

public static function PowerMenuTaxonomyHandler::getTaxonomyTermsFromEntity in Power Menu 7.2

Returns an array of taxonomy terms associated with tis entity.

Parameters

$entity: The entity

$type: The entity type

Return value

An array of terms

1 call to PowerMenuTaxonomyHandler::getTaxonomyTermsFromEntity()
PowerMenuTaxonomyHandler::getMenuPathToActivate in plugins/menu_handlers/PowerMenuTaxonomyHandler.class.php

File

plugins/menu_handlers/PowerMenuTaxonomyHandler.class.php, line 310

Class

PowerMenuTaxonomyHandler
Implementation of the interface PowerMenuHandlerInterface.

Code

public static function getTaxonomyTermsFromEntity($entity, $type) {
  $terms = array();
  $fileds = PowerMenuTaxonomyHandler::getTaxonomyFieldsFromEntity($type);
  foreach ($fileds as $field_name => $value) {
    if (!empty($entity->{$field_name})) {
      $items = field_get_items($type, $entity, $field_name);
      $terms = array_merge($terms, $items);
    }
  }
  return $terms;
}