Skip to content

Instantly share code, notes, and snippets.

@cafuego
Created August 1, 2012 03:53
Show Gist options
  • Save cafuego/3223498 to your computer and use it in GitHub Desktop.
Save cafuego/3223498 to your computer and use it in GitHub Desktop.
// Better yet, sue the language as defined in the entity. $entity->language?
foreach ($GLOBALS['user']->field_product_brand[LANGUAGE_NONE] as $term) {
if ($entity->field_product_brand[LANGUAGE_NONE][0]['tid'] == $term['tid'])
return $term['tid'];
}
}
return NULL;
@codexmas
Copy link

codexmas commented Aug 1, 2012

global $user;
$account = user_load($user->uid);
foreach ($account->field_product_brand[LANGUAGE_NONE] as $term) {
if ($entity->field_product_brand[LANGUAGE_NONE][0]['tid'] == $term['tid'])
drupal_set_message($term['tid']);
return $term['tid'];
}
}
return NULL;

@codexmas
Copy link

codexmas commented Aug 1, 2012

global $user;
$account = user_load($user->uid);
$entity = node_load($view->args[0]);
foreach ($account->field_product_brand[LANGUAGE_NONE] as $term) {
if ($entity->field_product_brand[LANGUAGE_NONE][0]['tid'] == $term['tid'])
return $term['tid'];
}
}
return NULL;

@codexmas
Copy link

codexmas commented Aug 1, 2012

global $user;
$account = user_load($user->uid);
$entity = node_load(arg(1));
foreach ($account->field_product_brand[LANGUAGE_NONE] as $term) {
if ($entity->field_product_brand[LANGUAGE_NONE][0]['tid'] == $term['tid'])
return $term['tid'];
}
}
return NULL;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment