本文整理汇总了PHP中taxonomy_term_load函数的典型用法代码示例。如果您正苦于以下问题:PHP taxonomy_term_load函数的具体用法?PHP taxonomy_term_load怎么用?PHP taxonomy_term_load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了taxonomy_term_load函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fieldFindCandidate
/**
* {@inheritdoc}
*/
function fieldFindCandidate(array $items)
{
$terms = array();
foreach ($items as $item) {
$terms[$item['tid']] = TRUE;
}
if (count($terms) > 1) {
$walk = $terms;
$visited = array();
while (!empty($walk)) {
$visited += $walk;
foreach ($walk as $tid => $true) {
$parents = taxonomy_get_parents($tid);
unset($walk[$tid]);
foreach ($parents as $parent_tid => $parent) {
unset($terms[$parent_tid]);
if (!isset($visited[$parent_tid])) {
$walk[$parent_tid] = $parent;
}
}
}
}
}
// Return the path of the first found term, if any.
foreach ($terms as $tid => $term_info) {
$term = taxonomy_term_load($tid);
if (!empty($term)) {
$uri = entity_uri('taxonomy_term', $term);
if (!empty($uri)) {
return $uri['path'];
}
}
}
return NULL;
}
示例2: term
public static function term($type, $value, $name)
{
if (!self::checkFieldValue($value, 'tid')) {
return null;
}
return new FieldValue($value, taxonomy_term_load($value['tid']), $type);
}
示例3: fs_core_preprocess_page
/**
* Implemements hook_process_page
* @param array $variables
*/
function fs_core_preprocess_page(&$variables)
{
//Search form
$search_form = drupal_get_form('search_form');
$search_form_box = drupal_render($search_form);
$variables['search_box'] = $search_form_box;
if ($views_page = views_get_page_view()) {
$variables['theme_hook_suggestions'][] = 'page__views__' . $views_page->name;
$variables['theme_hook_suggestions'][] = 'page__views__' . $views_page->name . '_' . $views_page->current_display;
}
if (isset($variables['node']->type)) {
$variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;
}
// changes the links tree for the main menu, since by
// default Drupal just provides first level ones
$menu_tree = menu_tree_all_data('main-menu');
$menu_tree = menu_tree_output($menu_tree);
foreach ($menu_tree as $k => $v) {
if (is_numeric($k) && count($v['#below'])) {
$menu_tree[$k]['#below']['#theme_wrappers'][0] = 'menu_tree__submenu';
}
}
$variables['main_menu'] = $menu_tree;
if (arg(0) == 'taxonomy' && arg(1) == 'term') {
$tid = (int) arg(2);
$term = taxonomy_term_load($tid);
if (is_object($term)) {
$variables['theme_hook_suggestions'][] = 'page__taxonomy__' . $term->vocabulary_machine_name;
}
}
}
示例4: songlap_preprocess_page
/**
* @file
* This file is empty by default because the base theme chain (Alpha & Omega) provides
* all the basic functionality. However, in case you wish to customize the output that Drupal
* generates through Alpha & Omega this file is a good place to do so.
*
* Alpha comes with a neat solution for keeping this file as clean as possible while the code
* for your subtheme grows. Please read the README.txt in the /preprocess and /process subfolders
* for more information on this topic.
*/
function songlap_preprocess_page(&$vars)
{
if (drupal_is_front_page()) {
$breadcrumb = array();
$breadcrumb[] = t('Home');
drupal_set_breadcrumb($breadcrumb);
}
if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_null(arg(3))) {
$term = taxonomy_term_load(arg(2));
$breadcrumb = '';
$breadcrumb .= '<div class="breadcrumb">';
$breadcrumb .= '<a href="' . $vars['front_page'] . '">' . t('Home') . '</a> ';
$breadcrumb .= '» ' . $term->name;
$breadcrumb .= '</div>';
$vars['breadcrumb'] = $breadcrumb;
}
if ($_GET['q'] == 'projects') {
$breadcrumb = '';
$breadcrumb .= '<div class="breadcrumb">';
$breadcrumb .= '<a href="' . $vars['front_page'] . '">' . t('Home') . '</a> ';
$breadcrumb .= '» ' . t('Projects');
$breadcrumb .= '</div>';
$vars['breadcrumb'] = $breadcrumb;
}
}
示例5: lt_preprocess_views_view
function lt_preprocess_views_view(&$vars)
{
if ($vars['view']->name == 'articles' && arg(0) == 'taxonomy') {
$term = taxonomy_term_load(arg(2));
$vars['header'] = '<h2 class="block-title">' . $term->name . '</h2>';
}
}
示例6: treetopstravel_preprocess_html
/**
* Implements hook_preprocess_html().
* Meta tags https://drupal.org/node/1468582#comment-5698732
*/
function treetopstravel_preprocess_html(&$variables)
{
$meta_charset = array('#tag' => 'meta', '#attributes' => array('charset' => 'utf-8'));
drupal_add_html_head($meta_charset, 'meta_charset');
$meta_x_ua_compatible = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'x-ua-compatible', 'content' => 'ie=edge, chrome=1'));
drupal_add_html_head($meta_x_ua_compatible, 'meta_x_ua_compatible');
$meta_mobile_optimized = array('#tag' => 'meta', '#attributes' => array('name' => 'MobileOptimized', 'content' => 'width'));
drupal_add_html_head($meta_mobile_optimized, 'meta_mobile_optimized');
$meta_handheld_friendly = array('#tag' => 'meta', '#attributes' => array('name' => 'HandheldFriendly', 'content' => 'true'));
drupal_add_html_head($meta_handheld_friendly, 'meta_handheld_friendly');
$meta_viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1'));
drupal_add_html_head($meta_viewport, 'meta_viewport');
$meta_cleartype = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'cleartype', 'content' => 'on'));
drupal_add_html_head($meta_cleartype, 'meta_cleartype');
// Use html5shiv.
if (theme_get_setting('html5shim')) {
$element = array('element' => array('#tag' => 'script', '#value' => '', '#attributes' => array('type' => 'text/javascript', 'src' => file_create_url(drupal_get_path('theme', 'treetopstravel') . '/js/html5shiv-printshiv.js'))));
$html5shim = array('#type' => 'markup', '#markup' => "<!--[if lt IE 9]>\n" . theme('html_tag', $element) . "<![endif]-->\n");
drupal_add_html_head($html5shim, 'treetopstravel_html5shim');
}
// Use Respond.js.
if (theme_get_setting('respond_js')) {
drupal_add_js(drupal_get_path('theme', 'treetopstravel') . '/js/respond.min.js', array('group' => JS_LIBRARY, 'weight' => -100));
}
// Use normalize.css
if (theme_get_setting('normalize_css')) {
drupal_add_css(drupal_get_path('theme', 'treetopstravel') . '/css/normalize.css', array('group' => CSS_SYSTEM, 'weight' => -100));
}
if (arg(0) == 'taxonomy' && arg(1) == 'term') {
$term = taxonomy_term_load(arg(2));
$variables['classes_array'][] = 'vocabulary-' . strtolower($term->vocabulary_machine_name);
}
flexslider_add();
}
示例7: snowpilot_unit_prefs_get
function snowpilot_unit_prefs_get($entity, $type = 'user')
{
$state_name = _helper_cleaner($entity, 'field_loaction', 'tid') != '' ? taxonomy_term_load(_helper_cleaner($entity, 'field_loaction', 'tid'))->name : '';
$range_name = _helper_cleaner($entity, 'field_loaction', 'tid', 1) != '' ? taxonomy_term_load(_helper_cleaner($entity, 'field_loaction', 'tid', 1))->name : '';
$unit_prefs = array('field_depth_0_from' => _helper_cleaner($entity, 'field_depth_0_from'), 'measureFrom' => _helper_cleaner($entity, 'field_depth_0_from'), 'field_depth_units' => _helper_cleaner($entity, 'field_depth_units'), 'depthUnits' => _helper_cleaner($entity, 'field_depth_units'), 'field_temp_units' => _helper_cleaner($entity, 'field_temp_units'), 'tempUnits' => _helper_cleaner($entity, 'field_temp_units'), 'field_coordinate_type' => _helper_cleaner($entity, 'field_coordinate_type'), 'coordType' => _helper_cleaner($entity, 'field_coordinate_type'), 'field_elevation_units' => _helper_cleaner($entity, 'field_elevation_units'), 'elvUnits' => _helper_cleaner($entity, 'field_elevation_units'), 'field_longitude_type' => _helper_cleaner($entity, 'field_longitude_type'), 'longType' => _helper_cleaner($entity, 'field_longitude_type'), 'field_latitude_type' => _helper_cleaner($entity, 'field_latitude_type'), 'latType' => _helper_cleaner($entity, 'field_latitude_type'), 'field_longitude' => _helper_cleaner($entity, 'field_longitude'), 'longitude' => _helper_cleaner($entity, 'field_longitude'), 'field_latitude' => _helper_cleaner($entity, 'field_latitude'), 'lat' => _helper_cleaner($entity, 'field_latitude'), 'field_utm_zone' => _helper_cleaner($entity, 'field_utm_zone'), 'zone' => _helper_cleaner($entity, 'field_utm_zone'), 'field_north' => _helper_cleaner($entity, 'field_north'), 'north' => _helper_cleaner($entity, 'field_north'), 'field_east' => _helper_cleaner($entity, 'field_east'), 'east' => _helper_cleaner($entity, 'field_east'), 'field_density_units' => _helper_cleaner($entity, 'field_density_units'), 'rhoUnits' => _helper_cleaner($entity, 'field_density_units'), 'field_fracture_category' => _helper_cleaner($entity, 'field_fracture_category'), 'fractureCat' => _helper_cleaner($entity, 'field_fracture_category'), 'field_hardness_scale' => _helper_cleaner($entity, 'field_hardness_scale'), 'hardnessScaling' => _helper_cleaner($entity, 'field_hardness_scale'), 'field_loaction_0' => _helper_cleaner($entity, 'field_loaction', 'tid'), 'state' => $state_name, 'field_loaction_1' => _helper_cleaner($entity, 'field_loaction', 'tid', '1'), 'range' => $range_name);
//////
/*
These fields are not present in the 'node' variable that this function works on.
*/
if ($type == 'user') {
$unit_prefs['field_first_name'] = _helper_cleaner($entity, 'field_first_name');
$unit_prefs['first'] = _helper_cleaner($entity, 'field_first_name');
$unit_prefs['field_last_name'] = _helper_cleaner($entity, 'field_last_name');
$unit_prefs['last'] = _helper_cleaner($entity, 'field_last_name');
$unit_prefs['field_phone'] = _helper_cleaner($entity, 'field_phone');
$unit_prefs['phone'] = _helper_cleaner($entity, 'field_phone');
$unit_prefs['field_professional'] = _helper_cleaner($entity, 'field_professional');
$unit_prefs['prof'] = _helper_cleaner($entity, 'field_professional');
$unit_prefs['field_professional_affiliation'] = _helper_cleaner($entity, 'field_professional_affiliation', 'tid');
$unit_prefs['affil'] = _helper_cleaner($entity, 'field_professional_affiliation', 'tid');
// tid needs to be converted to name
$unit_prefs['name'] = $entity->name;
// hey, this is the same key name in both core drupal and avscience db!
$unit_prefs['mail'] = $entity->mail;
$unit_prefs['email'] = $entity->mail;
}
return $unit_prefs;
}
示例8: gavias_laikafood_format_comma_field
function gavias_laikafood_format_comma_field($field_category, $node, $limit = NULL)
{
if (module_exists('i18n_taxonomy')) {
$language = i18n_language();
}
$category_arr = array();
$category = '';
$field = field_get_items('node', $node, $field_category);
if (!empty($field)) {
foreach ($field as $item) {
$term = taxonomy_term_load($item['tid']);
if ($term) {
if (module_exists('i18n_taxonomy')) {
$term_name = i18n_taxonomy_term_name($term, $language->language);
// $term_desc = tagclouds_i18n_taxonomy_term_description($term, $language->language);
} else {
$term_name = $term->name;
//$term_desc = $term->description;
}
$category_arr[] = l($term_name, 'taxonomy/term/' . $item['tid']);
}
if ($limit) {
if (count($category_arr) == $limit) {
$category = implode(', ', $category_arr);
return $category;
}
}
}
}
$category = implode(', ', $category_arr);
return $category;
}
示例9: jollyness_preprocess_html
function jollyness_preprocess_html(&$vars)
{
//Process portfolio color
if ($portfolio_category = taxonomy_vocabulary_machine_name_load('portfolio_category')) {
$terms = taxonomy_get_tree($portfolio_category->vid);
$less = new lessc();
$css = '';
$color = '';
$class = '';
foreach ($terms as $t) {
$term = taxonomy_term_load($t->tid);
$class = drupal_html_class($t->name);
if (!empty($term->field_color)) {
foreach ($term->field_color as $v) {
$color = $v[0]['value'];
break;
}
}
if ($color) {
$css .= ".dexp-masonry-filter,.dexp-portfolio-filter{.{$class} span:before{background-color: {$color} !important;}}";
$css .= ".{$class} .portfolio-item-overlay{background-color: rgba(red({$color}), green({$color}), blue({$color}), 0.7) !important;}";
}
}
$css = $less->compile($css);
drupal_add_css($css, array('type' => 'inline'));
}
}
示例10: suitcase_preprocess_region
function suitcase_preprocess_region(&$vars)
{
if ($vars['region'] == 'content' && arg(0) == 'node' && is_numeric(arg(1)) && arg(2) !== 'edit') {
$node = node_load(arg(1));
if ($node->type == 'people' && !empty($node->field_people_category)) {
$vars['categories'] = array();
foreach ($node->field_people_category[LANGUAGE_NONE] as $category) {
$tax = taxonomy_term_load($category['tid']);
array_push($vars['categories'], $tax->name);
}
}
} else {
if ($vars['region'] == 'branding') {
// Prepare Logo
$vars['suitcase_config_logo'] = FALSE;
$logo = variable_get('suitcase_config_logo');
$vars['site_name'] = variable_get('site_name');
if ($logo) {
$logo_url = file_create_url($logo['uri']);
$vars['suitcase_config_logo'] = '<div class="logo-img"><a href="' . $GLOBALS['base_url'] . '" rel="home" title="' . $vars['site_name'] . '" class="active"><img src="' . $logo_url . '" alt="Go to ' . $vars['site_name'] . ' home" id="logo" /></a></div>';
}
$vars['dept_url'] = variable_get('dept_url', $default = NULL);
$vars['show_isu_nameplate'] = variable_get('suitcase_config_isu_nameplate_display', 1);
}
}
}
示例11: hook_oa_core_space_type_options_alter
/**
* Alter the space_type or section_type options from other modules.
*
* @param array &$optionts
* An associative array keyed by the Taxonomy term id containing the option
* data returned by all module via hook_oa_core_space_type_options().
* @param string $vocab_name
* The name of the vocabulary that this Taxonomy term comes from.
*/
function hook_oa_core_space_type_options_alter(&$options, $vocab_name)
{
if ($vocab_name == 'space_type') {
foreach ($options as $tid => &$option) {
$term = taxonomy_term_load($tid);
// Modify some data on the option data.
$option['blah'] = 'arbitrary string';
}
}
}
示例12: localdm_get_other_link
function localdm_get_other_link($autre_lien)
{
$html_return = '<div class="sidefeature"><h3>Articles similaires:</h3><ul>';
foreach ($autre_lien['und'] as $categorie) {
$taxonomy = taxonomy_term_load($categorie['tid']);
$html_return .= '<li><a href="' . $taxonomy->field_lien_page['und'][0]['value'] . '">' . $taxonomy->name . '</a></li>';
}
$html_return .= '</ul></div>';
return $html_return;
}
示例13: suitcase_preprocess_region
function suitcase_preprocess_region(&$vars)
{
$vars['dept_url'] = variable_get('dept_url', $default = NULL);
if ($vars['elements']['#region'] == 'content' && arg(0) == 'node' && is_numeric(arg(1)) && arg(2) !== 'edit') {
$node = node_load(arg(1));
if ($node->type == 'people' && !empty($node->field_people_category)) {
$vars['categories'] = array();
foreach ($node->field_people_category[LANGUAGE_NONE] as $category) {
$tax = taxonomy_term_load($category['tid']);
array_push($vars['categories'], $tax->name);
}
}
}
}
示例14: createGFCTournament
function createGFCTournament($mynodeidparent)
{
// /********************************************************************************
// //CREATE A TOURNAMENT and Update Drupal Tournaments Node with Challonge tourney ID
//
// Include the Challonge API Class
include '/opt/bitnami/apps/drupal/htdocs/includes/challonge.class.php';
$c = new ChallongeAPI('XqrMnBPs15MvmX0izddB4zyIHKswRCoaIAyq4cTt');
// get the GFC data needed to create tourney in Challonge
//$mynodeidparent = 18; //test id for debugging
$node = node_load($mynodeidparent);
$wrapper = entity_metadata_wrapper('node', $node);
// retreive param values needed from GFC data
// get tourney name
$tourney_name = $wrapper->field_tournament_name->value();
// get type of play
$term = taxonomy_term_load($wrapper->field_tournament_type->raw());
$wrapper2 = entity_metadata_wrapper('taxonomy_term', $term);
$tourney_type = $term->name;
// get description
$tourney_descriptions = $wrapper->field_tournament_description->value();
//get url value
$tourney_url = (string) uniqid();
//str_replace ( ' ', '', $tourney_name ); // TODO: invent good url scheme
// set paramater values for challonge from GFC values
$params = array("tournament[name]" => $tourney_name, "tournament[tournament_type]" => $tourney_type, "tournament[url]" => $tourney_url, "tournament[description]" => $tourney_descriptions);
// call to challonge to create tournament
$tournament = $c->makeCall("tournaments", $params, "post");
$tournament = $c->createTournament($params);
//Save new URL value to GFC
$wrapper->field_tournament_challonge_url->set($tourney_url);
// save value
$wrapper->save();
// *************************
// update GFC with returned tournament ID
// *************************
//****************NOTE: Need to reload by URL value from CHALLONGE due to bug
$tournament_id = $tourney_url;
$params = array("include_matches " => 0);
$tournament = $c->makeCall("tournaments/{$tournament_id}", $params, "get");
$tournament = $c->getTournament($tournament_id, $params);
// retreive new tournament id and set to variable
$challonge_id = (int) $tournament->id;
// id set value
$wrapper->field_tournament_challonge_id->set($challonge_id);
//set url value
// save value
$wrapper->save();
return $c->result;
}
示例15: os_taxonomy_vsite_path
/**
* Get the path of the vsite which the vocab belong.
*
* @param $tid
* The term ID.
*
* @return
* The path of the vsite.
*/
function os_taxonomy_vsite_path($tid)
{
$term = taxonomy_term_load($tid);
$purls =& drupal_static(__FUNCTION__, array());
if (in_array($term->vid, $purls)) {
// We already found purl for this vocab. Return the purl from the static
// cache.
return $purls[$term->vid];
}
$relation = og_vocab_relation_get($term->vid);
$vsite = vsite_get_vsite($relation->gid);
$purls[$term->vid] = $vsite->group->purl;
return $vsite->group->purl;
}