• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP taxonomy_get_term_by_name函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中taxonomy_get_term_by_name函数的典型用法代码示例。如果您正苦于以下问题:PHP taxonomy_get_term_by_name函数的具体用法?PHP taxonomy_get_term_by_name怎么用?PHP taxonomy_get_term_by_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了taxonomy_get_term_by_name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: prepare

 /**
  * Override Migration::prepare().
  *
  * Set the term parent for heirarchical terms
  *
  * @param $term
  * @param $row
  */
 public function prepare($term, $row)
 {
     // Handle og_vocab
     $vocab_name = $this->bundle;
     if (!($vocabulary = taxonomy_vocabulary_machine_name_load($vocab_name))) {
         // Create a new vocabulary
         $vocabulary = (object) array('name' => 'Meter categories for ' . $row->account_id, 'description' => 'Meter categories for ' . $row->account_id, 'machine_name' => $vocab_name);
         taxonomy_vocabulary_save($vocabulary);
     }
     // Create an OG-vocab and relate new vocabulary with OG.
     $account_id = $term->account_id['destid1'];
     $settings = array('cardinality' => 1, 'required' => TRUE);
     // Loop for all meter content-types and create og-vocabulary.
     $node_types = node_type_get_types();
     foreach ($node_types as $content_type) {
         if (strpos($content_type->type, '_meter') === FALSE) {
             // Not a meter type, skip.
             continue;
         }
         $og_vocab = og_vocab_create_og_vocab($vocabulary->vid, 'node', $content_type->type, OG_VOCAB_FIELD, $settings);
         $og_vocab->save();
     }
     og_vocab_relation_save($vocabulary->vid, 'node', $account_id);
     // Save vocabulary id.
     $term->vid = $vocabulary->vid;
     // Handle parent.
     $term->name = ucwords(trim($term->name));
     $parent = ucwords(trim($row->parent));
     $parent_term = taxonomy_get_term_by_name($parent, $vocab_name);
     $parent_term = reset($parent_term);
     if ($parent_term) {
         $term->parent = $parent_term->tid;
     }
 }
开发者ID:Gizra,项目名称:negawatt-server,代码行数:42,代码来源:NegawattMeterCategoryTermsBase.php


示例2: checkTerms

 public static function checkTerms($vocabName, $termName)
 {
     /*@param $vocabName
      *@param $termName
      *@return $tid
      */
     $vocab = taxonomy_vocabulary_machine_name_load($vocabName);
     $vid = $vocab->vid;
     //check term
     $checkTerm = taxonomy_get_term_by_name($termName, $vocabName);
     if (empty($checkTerm)) {
         $term = new stdClass();
         $term->name = $termName;
         $term->vid = $vid;
         taxonomy_term_save($term);
         $termArray = taxonomy_get_term_by_name($termName, $vocabName);
         $term = current($termArray);
         $tid = $term->tid;
         return $tid;
     } else {
         $term = current($checkTerm);
         $tid = $term->tid;
         return $tid;
     }
 }
开发者ID:rochester-rcl,项目名称:rcl-seward-transformations,代码行数:25,代码来源:letter_node_generator.php


示例3: externalPreviewsAreEnabledForFormat

 /**
  * @Given :provider previews are :setting for :format_name resources
  *
  * Changes variables in the database to enable or disable external previews
  */
 public function externalPreviewsAreEnabledForFormat($provider, $setting, $format_name)
 {
     $format = current(taxonomy_get_term_by_name($format_name, 'format'));
     $preview_settings = variable_get("dkan_dataset_format_previews_tid{$format->tid}", array());
     // If $setting was "enabled," the preview is turned on. Otherwise, it's
     // turned off.
     $preview_settings[$provider] = $setting == 'enabled' ? $provider : 0;
     variable_set("dkan_dataset_format_previews_tid{$format->tid}", $preview_settings);
 }
开发者ID:nucivic,项目名称:dkanextension,代码行数:14,代码来源:ResourceContext.php


示例4: expand

 /**
  * {@inheritdoc}
  */
 public function expand($values)
 {
     $return = array();
     foreach ($values as $name) {
         $terms = taxonomy_get_term_by_name($name, $this->getVocab());
         if (!$terms) {
             throw new \Exception(sprintf("No term '%s' exists.", $name));
         }
         $return[$this->language][] = array('tid' => array_shift($terms)->tid);
     }
     return $return;
 }
开发者ID:shrimala,项目名称:DrupalDriver,代码行数:15,代码来源:TaxonomyTermReferenceHandler.php


示例5: analysize_api_tags

/**
 * This function is used to verify api tags with cms tags and update its status 
 * $tag_names pass parameter as api tags
 * $tag_status mena its verified tags or unverified tag
 */
function analysize_api_tags($tag_names, $tag_status, $all_tids, $node)
{
    $tag_status = $tag_status == 'Verified' ? 'verified' : 'unverified';
    foreach ($tag_names as $tag_name) {
        $terms = taxonomy_get_term_by_name($tag_name, 'tags');
        if (empty($terms)) {
            $node->field_tags['und'][]['tid'] = custom_create_taxonomy_term($tag_name, 1, $tag_status);
            continue;
        }
        foreach ($terms as $key => $term) {
            $term->name = $tag_name;
            $term_id = $term->tid;
            if (!in_array($term_id, $all_tids)) {
                $node->field_tags['und'][]['tid'] = $term->tid;
            }
            update_tag_status($term, 'base', $tag_status);
        }
    }
    api_node_save($node);
}
开发者ID:sanjay9267,项目名称:dnaindia,代码行数:25,代码来源:topic_cron.php


示例6: createTip

function createTip($content)
{
    $term1 = taxonomy_get_term_by_name($content[0]);
    $term2 = taxonomy_get_term_by_name($content[1]);
    $tip = trim($content[2]);
    print "tip is: " . $content[0] . "," . $content[1] . "," . $content[2] . "\n";
    print "      : " . $term1[0]->tid . "," . $term2[0]->tid . "," . $tip . "\n";
    $terms = array($term1[0]->tid, $term2[0]->tid);
    $node = new stdClass();
    $node->type = 'quicktip';
    $node->title = $tip;
    $node->body = '';
    $node->teaser = '';
    $node->uid = 1;
    $node->language = 'en';
    $node->status = 0;
    $node->promote = 0;
    $node->field_ordinal = array(array('value' => $ordinal));
    $node->field_source = array(array('value' => $source));
    $node->taxonomy = $terms;
    node_save($node);
}
开发者ID:ericlink,项目名称:asthma-adherence-and-general-health-sms,代码行数:22,代码来源:asthma_quicktip_node_loader.php


示例7: expand

 /**
  * {@inheritdoc}
  */
 public function expand($values)
 {
     $result = array();
     $values = (array) $values;
     foreach ($values as $entry) {
         $terms = explode(',', $entry);
         foreach ($terms as $term) {
             // Try to split things out in order to find optional specified vocabs.
             $term_name_or_tid = '';
             $parts = explode(':', $term);
             if (count($parts) == 1) {
                 $term_name_or_tid = $term;
             } elseif (count($parts) == 2) {
                 $term_name_or_tid = $term;
             }
             if ($term_list = taxonomy_get_term_by_name($term_name_or_tid)) {
                 $term = reset($term_list);
                 $result[] = $term;
             }
         }
     }
     return $result;
 }
开发者ID:stovak,项目名称:DrupalDriver,代码行数:26,代码来源:TaxonomyHandler.php


示例8: set_article_categories

function set_article_categories($articleobj, $bundle, $categoryObj = NULL)
{
    $type = variable_get('brafton_existing_type');
    //Grabs the categories from the feed.
    if ($categoryObj != NULL) {
        $categories = array($categoryObj);
        $video_loader = true;
        $type = 'b_video';
    } else {
        $categories = $articleobj->getCategories();
        $video_loader = false;
    }
    switch ($type) {
        case 'b_news':
            $vocab = 'b_news_t';
            break;
        case 'b_video':
            $vocab = 'b_news_v';
            break;
        default:
            $info = field_info_field(variable_get('brafton_custom_taxonomy'));
            $vocab = $info['settings']['allowed_values'][0]['vocabulary'];
            break;
    }
    //Checks to see if the terms already exist in the Brafton Taxonomy Vocabulary.  If they do not, new terms are created.
    $i = 0;
    $brafton_vocabulary = taxonomy_vocabulary_machine_name_load($vocab);
    $vid = $brafton_vocabulary->vid;
    $cat_array = array();
    foreach ($categories as $category) {
        if ($video_loader) {
            $name = $categories[0]->name;
        } else {
            $name = get_category($categories, $i);
            $i = $i + 1;
        }
        $check_cat = taxonomy_get_term_by_name($name);
        $found = 0;
        foreach ($check_cat as $term) {
            if ($term->vid == $vid) {
                $tid = $term->tid;
                $found = 1;
            }
        }
        if ($found == 0) {
            $new_term = array('vid' => $vid, 'name' => $name);
            $new_term = (object) $new_term;
            taxonomy_term_save($new_term);
            $tid = $new_term->tid;
        }
        array_push($cat_array, $tid);
    }
    //Returns an array of valid term ids for the given article.
    return $cat_array;
}
开发者ID:ContentLEAD,项目名称:BraftonDrupal7Module,代码行数:55,代码来源:BraftonFunctions.php


示例9: termCreate

 /**
  * {@inheritdoc}
  */
 public function termCreate(\stdClass $term)
 {
     // Map vocabulary names to vid, these take precedence over machine names.
     if (!isset($term->vid)) {
         $vocabularies = \taxonomy_get_vocabularies();
         foreach ($vocabularies as $vid => $vocabulary) {
             if ($vocabulary->name == $term->vocabulary_machine_name) {
                 $term->vid = $vocabulary->vid;
             }
         }
     }
     if (!isset($term->vid)) {
         // Try to load vocabulary by machine name.
         $vocabularies = $this->taxonomyVocabularyLoadMultiple(array($term->vid));
         if (!empty($vocabularies)) {
             $vids = array_keys($vocabularies);
             $term->vid = reset($vids);
         }
     }
     // If `parent` is set, look up a term in this vocab with that name.
     if (isset($term->parent)) {
         $parent = \taxonomy_get_term_by_name($term->parent);
         if (!empty($parent)) {
             $parent = reset($parent);
             $term->parent = $parent->tid;
         }
     }
     if (empty($term->vid)) {
         throw new \Exception(sprintf('No "%s" vocabulary found.'));
     }
     // Attempt to decipher any fields that may be specified.
     $this->expandEntityFields('taxonomy_term', $term);
     // Protect against a failure from hook_taxonomy_term_insert() in pathauto.
     $current_path = getcwd();
     chdir(DRUPAL_ROOT);
     $term_array = (array) $term;
     \taxonomy_save_term($term_array);
     chdir($current_path);
     // Loading a term by name returns an array of term objects, but there should
     // only be one matching term in a testing context, so take the first match
     // by reset()'ing $matches.
     $matches = \taxonomy_get_term_by_name($term->name);
     $saved_term = reset($matches);
     return $saved_term;
 }
开发者ID:acbramley,项目名称:DrupalDriver,代码行数:48,代码来源:Drupal6.php


示例10: processAfterSubmit

 /**
  * This function is called after an EntityForm is submitted. Iterate over
  * $termNames variable and see which ones have taxonomy terms. These taxonomy
  * terms are created during form submission. Add these to global $entities
  * object so that they can be deleted later.
  *
  * @param Form $formObject
  *   Form object.
  * @param string $field_name
  *   Field name.
  *
  * @return array
  *   An array with 2 values:
  *   (1) $success: TRUE.
  *   (2) $msg: An empty string.
  */
 public static function processAfterSubmit(Form $formObject, $field_name)
 {
     if (self::isCckField($formObject, $field_name)) {
         $field_info = Field::getFieldInfo($field_name);
         $vocabulary = $field_info['settings']['allowed_values'][0]['vocabulary'];
         $class = "RedTest\\entities\\TaxonomyTerm\\" . Utils::makeTitleCase($vocabulary);
         if (sizeof(self::$termNames)) {
             global $entities;
             foreach (self::$termNames as $termName) {
                 $terms = taxonomy_get_term_by_name($termName, $vocabulary);
                 foreach ($terms as $tid => $term) {
                     // We are assuming that there will be only one term with the same
                     // name in a given vocabulary.
                     $entities['taxonomy_term'][$tid] = new $class($tid);
                     unset(self::$termNames[$termName]);
                 }
             }
         }
     }
     return new Response(TRUE, NULL, "");
 }
开发者ID:redcrackle,项目名称:redtest-core,代码行数:37,代码来源:TaxonomyTermReference.php


示例11: get_title_data

function get_title_data()
{
    $navigation_vocab = 'taxanavigation';
    $trail = menu_get_active_trail();
    $taxon = taxonomy_get_term_by_name($trail[2]['title'], $navigation_vocab);
    reset($taxon);
    return current($taxon);
}
开发者ID:mwagdi,项目名称:gbif-portal,代码行数:8,代码来源:template.php


示例12: termCreate

 /**
  * {@inheritdoc}
  */
 public function termCreate(\stdClass $term)
 {
     // Map vocabulary names to vid, these take precedence over machine names.
     if (!isset($term->vid)) {
         $vocabularies = \taxonomy_get_vocabularies();
         foreach ($vocabularies as $vid => $vocabulary) {
             if ($vocabulary->name == $term->vocabulary_machine_name) {
                 $term->vid = $vocabulary->vid;
             }
         }
     }
     if (!isset($term->vid)) {
         // Try to load vocabulary by machine name.
         $vocabularies = \taxonomy_vocabulary_load_multiple(FALSE, array('machine_name' => $term->vocabulary_machine_name));
         if (!empty($vocabularies)) {
             $vids = array_keys($vocabularies);
             $term->vid = reset($vids);
         }
     }
     // If `parent` is set, look up a term in this vocab with that name.
     if (isset($term->parent)) {
         $parent = \taxonomy_get_term_by_name($term->parent, $term->vocabulary_machine_name);
         if (!empty($parent)) {
             $parent = reset($parent);
             $term->parent = $parent->tid;
         }
     }
     if (empty($term->vid)) {
         throw new \Exception(sprintf('No "%s" vocabulary found.'));
     }
     // Attempt to decipher any fields that may be specified.
     $this->expandEntityFields('taxonomy_term', $term);
     \taxonomy_term_save($term);
     return $term;
 }
开发者ID:acbramley,项目名称:DrupalDriver,代码行数:38,代码来源:Drupal7.php


示例13: DeleteTerm

 /**
  * Delete a term in a given vocabulary.
  *
  * @param $term_name
  *  The name of the term.
  */
 public static function DeleteTerm($term_name)
 {
     $taxonomies = taxonomy_get_term_by_name($term_name);
     $term = reset($taxonomies);
     taxonomy_term_delete($term->tid);
 }
开发者ID:aleph-n,项目名称:opencholar,代码行数:12,代码来源:FeatureHelper.php


示例14: _panelize_gm_nodes

function _panelize_gm_nodes(&$variables)
{
    if (isset($variables['node'])) {
        $node = $variables['node'];
        $gmCTs = array('good_practice' => 'Good Practices', 'structure' => 'Structures', 'method_tool' => 'Methods & Tools', 'resource' => 'Other resources');
        $gmTopicCTs = array('structure', 'method_tool', 'resource');
        if (array_key_exists($node->type, $gmCTs) && isset($node->field_topic) && isset($node->field_topic['und'][0])) {
            $tId = $node->field_topic['und'][0]['tid'];
            $nodeTopic = taxonomy_term_load($tId);
            $tcId = $nodeTopic->field_topic_category['und'][0]['tid'];
            $gmTopicTerm = taxonomy_get_term_by_name('Gender Mainstreaming', 'topics');
            reset($gmTopicTerm);
            $gmTopicTermId = key($gmTopicTerm);
            $gmTopicCategoryTerm = taxonomy_get_term_by_name('Gender Mainstreaming', 'topic_categories');
            reset($gmTopicCategoryTerm);
            $gmTopicCategoryTermId = key($gmTopicCategoryTerm);
            // only nodes with GM topic category (good practices) or GM topic (structures, methods & tools, resources) should be panelized
            if ($tcId != $gmTopicCategoryTermId || in_array($node->type, $gmTopicCTs) && $tId != $gmTopicTermId) {
                return;
            }
            $countryName = $node->field_country['und'][0]['safe_value'];
            $countryUrl = strtolower(str_replace(" ", "-", $countryName));
            $panes = array('about' => 'About', 'structures' => 'Structures', 'laws-and-policies' => 'Laws & Policies', 'methods-and-tools' => 'Methods & Tools', 'good-practices' => 'Good Practices', 'resources' => 'Other resources');
            $main_html_prefix = '<div class="page-gender-mainstreaming-countries panelized-gm-node">' . '<h1 class="title" id="page-title"><span class="country">' . $countryName . '</span> ' . $gmCTs[$node->type] . '</h1>' . '<div class="content-header">' . '<h2 class="element-invisible">Primary tabs</h2>' . '<ul class="button-group">';
            foreach ($panes as $paneUrl => $paneName) {
                $active = $paneName == $gmCTs[$node->type];
                $main_html_prefix .= '<li' . ($active ? ' class="active"' : '') . '><a class="small button secondary' . ($active ? ' active' : '') . '" href="/gender-mainstreaming/countries/' . $countryUrl . '/' . $paneUrl . '">' . $paneName . '' . ($active ? '<span class="element-invisible">(active tab)</span>' : '') . '</a></li>';
            }
            $main_html_prefix .= '</ul></div></div>';
            $variables['main_html_prefix'] = $main_html_prefix;
        }
    }
}
开发者ID:EIGE,项目名称:www_staging,代码行数:33,代码来源:template.php


示例15: entity_metadata_wrapper

*/
?>
<!-- 	<b>Research Topics:</b>  -->
<?php 
// echo $result;
?>
<!-- <br> -->
<?php 
// }
?>

<?php 
$wrapper = entity_metadata_wrapper('node', $node);
foreach ($wrapper->field_people_spa as $i) {
    $values = $i->field_people_spa_title->value();
    $terms = taxonomy_get_term_by_name($i->field_people_spa_title->value());
    if (!empty($terms)) {
        $first_term = array_shift($terms);
        $first_term->tid;
    }
    $array_spa[] = "<a href=" . $base_url . "/taxonomy/term/" . rawurlencode(ucfirst($first_term->tid)) . ">" . ucfirst(trim($values)) . "</a>";
}
$result_spa = implode(", ", $array_spa);
if ($result_spa) {
    ?>
	<b>National Strategic Program Areas:</b>
	<?php 
    echo $result_spa;
    ?>
	<br>
<?php 
开发者ID:phpsubbarao,项目名称:test-core,代码行数:31,代码来源:page--people.tpl.php


示例16: newstory

/**
 * Adds story as a drupal node to our site.
 */
function newstory($head, $body, $taxonomy, $date, $data)
{
    global $mniblogpub_props;
    $cfg = $mniblogpub_props["mniblogpub.php"];
    // Check ContentType
    $pdf_file = null;
    if ($data['ContentType'] == "UUSTORY") {
        $pdf_file = move_pdf($body);
    }
    // Load data
    $author = loadAuthor();
    $format = loadFormat();
    $status = $cfg["node.status_published"] == 1;
    $codenums = array();
    $txttbl = 0;
    // Load taxonomy data
    foreach ($taxonomy as $key => $value) {
        $tt = $value;
        if ($cfg["node.taxonomy.load_from"] == "description") {
            $tt = tax_getHumanName_sql($value);
        }
        $theterm = taxonomy_get_term_by_name($tt);
        //if($value = "txttbl")
        //	$txttbl = "Text Table";
        foreach ($theterm as $mkey => $mvalue) {
            $codenums[] = $mvalue->tid;
        }
    }
    // Basic Data
    $node = array('type' => $cfg["node.type"], 'title' => $head, 'uid' => $cfg["user.use"] == 1 ? $author->uid : 3, 'name' => $cfg["user.use"] == 1 ? $author->name : 'mnieditor', 'status' => $status, 'comment' => $cfg["node.comments"] == 1 ? 2 : 0, 'promote' => 1, 'taxonomy' => $codenums, 'revision' => 1, 'format' => 1, 'body' => $data['ContentType'] == "UUSTORY" ? richbody($pdf_file) : $body);
    // Alacarte Specific
    if ($cfg["node.type"] == "alacarte_article") {
        $product_nid = newproduct($node, $data);
        $node['body'] = get_first_paragraph($body);
        $node['field_full_body'] = array(0 => array("value" => $body, "format" => $format));
        $node['field_product_nid'] = array(0 => array("value" => $product_nid));
        //$node['field_txttbl'] = array(0=> array("value" => $txttbl));
    }
    // Embargo specific
    if ($cfg["modules.mnembargo"] && module_exists('mnembargo')) {
        if ($data['mnembargo'] > 0) {
            $node['time_to_pub'] = $data['mnembargo'];
            $node['status'] = 0;
        }
    }
    // Expire Specific
    if ($cfg["modules.mnexpire"] && module_exists('mnexpire')) {
        $node['time_to_exp'] = $data['mnexpire'];
    }
    if ($format) {
        $node['format'] = $format;
    }
    if ($data['ContentType'] == "UUSTORY") {
        if ($cfg["rich.type"]) {
            $node['type'] = $cfg["rich.type"];
        }
        $node['format'] = 3;
    }
    $node = node_submit($node);
    // Final Changes
    if ($cfg["date.adjust"] == 1) {
        $node->created = intval($date);
        $node->changed = intval($date);
        if ($data['ContentType'] == "UUSTORY") {
            $node->files[$pdf_file->fid] = $pdf_file;
        }
    }
    // SAVE!
    node_save($node);
    $article_nid = $node->nid;
    //unset($node);
    // Aftermath
    if ($cfg["node.type"] == "alacarte_article") {
        set_uc_node_access_feature($product_nid, $article_nid);
    }
    return $node;
}
开发者ID:freighthouse,项目名称:code,代码行数:80,代码来源:mniblogpub.php


示例17: getUniqueName

 /**
  * Returns a unique term name that doesn't already exist.
  *
  * @param null|string $vocabulary_machine_name
  *   Vocabulary machine name if the term name is supposed to be unique in
  *   that vocabulary or NULL if the term name is supposed to be unique across
  *   all the vocabularies.
  *
  * @return string
  *   Unique term name.
  */
 public static function getUniqueName($vocabulary_machine_name = NULL)
 {
     do {
         $name = Utils::getRandomText(20);
         $terms = taxonomy_get_term_by_name($name, $vocabulary_machine_name);
     } while (sizeof($terms));
     return $name;
 }
开发者ID:redcrackle,项目名称:redtest-core,代码行数:19,代码来源:TaxonomyTerm.php


示例18: user_get_proxy_list

function user_get_proxy_list()
{
    $proxy_taxo_data = taxonomy_get_term_by_name('Carrefour Proxy');
    $proxy_ids = NULL;
    foreach ($proxy_taxo_data as $data) {
        $proxy_ids = $data->tid;
    }
    $proxy_child_ids = taxonomy_get_children($proxy_ids);
    $array_proxy = array();
    if (!empty($proxy_child_ids)) {
        foreach ($proxy_child_ids as $value) {
            $array_proxy[] = $value->tid;
        }
    }
    return $array_proxy;
}
开发者ID:singhneeraj,项目名称:fr-store,代码行数:16,代码来源:user-api.php


示例19: implode

  * and append 0.02 to longitude value in order to display properly in gmap view
  */
 if (!isset($coordinatesGroup[$coordinates[0] . $coordinates[1]])) {
     $coordinatesGroup[$coordinates[0] . $coordinates[1]] = 0;
 } else {
     $coordinatesGroup[$coordinates[0] . $coordinates[1]]++;
     $coordinates[1] = $coordinates[1] + 0.02 * $coordinatesGroup[$coordinates[0] . $coordinates[1]];
 }
 /*
  * marker text
  */
 $text = $row['field_first_name'] . $inlineDelim . $row['title'] . $paragraphDelim . $affiliationInfo . $paragraphDelim . implode($paragraphDelim, $groups);
 /*
  * get icon from taxonomy term
  */
 $term_tree = taxonomy_get_term_by_name($groups[0]);
 foreach ($term_tree as $term) {
     //var_dump($term);
     $icon = !empty($term) && !empty($term->field_marker_url) ? $term->field_marker_url['und']['0']['value'] : 'marker.png';
 }
 /*
  * markers options: https://developers.google.com/maps/documentation/javascript/reference?csw=1#MarkerOptions
  * markers icons: http://mabp.kiev.ua/2010/01/12/google-map-markers/
  */
 $icon_url = file_create_url(variable_get('file_public_path', conf_path() . '/files') . '/gmap3_markers/' . $icon);
 $markers[] = gmap3_tools_create_marker($coordinates[0], $coordinates[1], '', $text, array('icon' => $icon_url, 'group' => $groups[0]));
 /*
  * legend info
  */
 if (empty($legendInfo[$groups[0]])) {
     $legendInfo[$groups[0]] = array('iconUrl' => $icon_url, 'text' => $groups[0]);
开发者ID:VTsantilis,项目名称:water-test,代码行数:31,代码来源:views-view-table--gmap-persons.tpl.php


示例20: count

$x = 0;
$numItems = count($wrapper->field_research_geography);
if ($numItems) {
    ?>
							<b>Geography:</b> <span class="rec-span">
							<?php 
    foreach ($wrapper->field_research_geography as $b => $i) {
        /*	$terms = taxonomy_get_term_by_name($i->field_state->value());
        			if (!empty($terms)) {
        			  $first_term = array_shift($terms);
        			  $first_term->tid;
        			}*/
        $values = $i->field_state->value();
        $numItems = count($values);
        foreach ($values as $key => $value) {
            $terms = taxonomy_get_term_by_name(trim($values[$key]->name));
            if (!empty($terms)) {
                $first_term = array_shift($terms);
                $first_term->tid;
            }
            $a = "<a href=" . $base_url . "/taxonomy/term/" . rawurlencode($first_term->tid) . ">" . ucfirst(trim($values[$key]->name)) . "</a>";
            echo $a;
            if ($x != $numItems) {
                echo ", ";
            }
            $x++;
        }
    }
    ?>
 
							</span><br>
开发者ID:phpsubbarao,项目名称:test-core,代码行数:31,代码来源:page--research_highlights.tpl.php



注:本文中的taxonomy_get_term_by_name函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP taxonomy_get_tree函数代码示例发布时间:2022-05-23
下一篇:
PHP taxonomy_exists函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap