本文整理汇总了PHP中field_view_value函数的典型用法代码示例。如果您正苦于以下问题:PHP field_view_value函数的具体用法?PHP field_view_value怎么用?PHP field_view_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了field_view_value函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: noreg_preprocess_node__sale_ad
function noreg_preprocess_node__sale_ad(&$variables)
{
// All node types but page
if ($variables['elements']['#view_mode'] != 'page') {
// Litter
if ($field_litter = field_get_items('node', $variables['node'], 'field_litter_id')) {
$node_litter = node_load($field_litter[0]['target_id']);
// Birthdate
if ($field_litter_birthdate = field_get_items('node', $node_litter, 'field_birthdate')) {
$variables['litter_birthdate'] = field_view_value('node', $node_litter, 'field_birthdate', $field_litter_birthdate[0], array('settings' => array('format_type' => 'custom_short')));
}
// Price per young
if ($field_litter_price_per_young = field_get_items('node', $node_litter, 'field_price_per_young')) {
$variables['litter_price_per_young'] = field_view_value('node', $node_litter, 'field_price_per_young', $field_litter_price_per_young[0]);
}
// Animal
if ($field_animal = field_get_items('node', $node_litter, 'field_animal_id')) {
$node_animal = node_load($field_animal[0]['target_id']);
// Breed
if ($field_breed = field_get_items('node', $node_animal, 'field_breed_id')) {
$variables['animal_breed'] = field_view_value('node', $node_animal, 'field_breed_id', $field_breed[0]);
}
}
}
// User
if ($node_creator = ha_user_get_raw_information($variables['user']->uid)) {
// Location
if (isset($node_creator['location'])) {
$variables['user_location'] = $node_creator['location'];
}
}
}
}
开发者ID:bellcom,项目名称:noreg,代码行数:33,代码来源:template.php
示例2: field_view_values
public function field_view_values($entity_type, $entity, $field_name, $display = array(), $langcode = NULL)
{
$items = field_get_items($entity_type, $entity, $field_name);
if ($items) {
$output = array();
foreach ($items as $item) {
$output[] = field_view_value($entity_type, $entity, $field_name, $item, $display, $langcode);
}
return $output;
}
}
开发者ID:bangpound,项目名称:drupal-bundle,代码行数:11,代码来源:RenderExtension.php
示例3: ssd_preprocess_node
function ssd_preprocess_node(&$variables)
{
$node = $variables['node'];
$variables['title'] = check_plain($node->title);
if ($node->type == 'article') {
// Get only the first body summary for a module.
$body = field_get_items('node', $node, 'body');
$variables['summary'] = field_view_value('node', $node, 'body', $body[0], 'teaser');
$variables['metadata'] = field_view_field('node', $node, 'field_metadata', 'default');
}
}
开发者ID:seefood,项目名称:ssd,代码行数:11,代码来源:template.php
示例4: venture_theme_preprocess_page
/**
* Override or insert variables into the page template.
*/
function venture_theme_preprocess_page(&$vars)
{
if (drupal_is_front_page()) {
$vars['images'] = array();
$query = db_select('node', 'n')->fields('n', array('nid'))->condition('type', 'slider_item', '=')->range(0, 3)->execute();
$view = $query->fetchAssoc();
foreach ($view as $item) {
$node = node_load($item);
$image_field = field_get_items('node', $node, 'field_image');
$image = field_view_value('node', $node, 'field_image', $image_field[0], array('type' => 'image', 'settings' => array('image_style' => 'slider_item', 'image_link' => NULL)));
$vars['images'][] = $image;
}
}
if (isset($vars['main_menu'])) {
$vars['main_menu'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('class' => array('links', 'main-menu', 'clearfix')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
} else {
$vars['main_menu'] = FALSE;
}
if (isset($vars['secondary_menu'])) {
$vars['secondary_menu'] = theme('links__system_secondary_menu', array('links' => $vars['secondary_menu'], 'attributes' => array('class' => array('links', 'secondary-menu', 'clearfix')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
} else {
$vars['secondary_menu'] = FALSE;
}
}
开发者ID:AVE303,项目名称:janenjoost,代码行数:27,代码来源:template.php
示例5: field_get_items
<?php
$alignment = field_get_items('paragraphs_item', $paragraphs_item, 'field_alignment');
$alignment = empty($alignment[0]['value']) ? 'center' : $alignment[0]['value'];
$heading = field_get_items('paragraphs_item', $paragraphs_item, 'field_heading');
$heading = empty($heading[0]['value']) ? '' : $heading[0]['value'];
$subheading = field_get_items('paragraphs_item', $paragraphs_item, 'field_subheading');
$subheading = empty($subheading[0]['value']) ? '' : $subheading[0]['value'];
$text = field_get_items('paragraphs_item', $paragraphs_item, 'field_text');
$text = empty($text[0]['value']) ? '' : $text[0]['value'];
$image = field_get_items('paragraphs_item', $paragraphs_item, 'field_image');
$image_renderable = field_view_value('paragraphs_item', $paragraphs_item, 'field_image', $image[0]);
?>
<?php
if ($alignment == "center") {
?>
<div class="row">
<div class="col-sm-12 center-text">
<?php
print render($image_renderable);
?>
</div>
</div>
<div class="row">
<div class="col-sm-12 center-text">
<?php
if ($heading) {
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:31,代码来源:paragraphs-item--image-feature.tpl.php
示例6: field_get_items
<?php
}
?>
<h5>
<?php
if (!empty($field_external_author)) {
?>
<span style="margin-right:3px;">By:</span>
<?php
$field = field_get_items('node', $node, 'field_external_author');
print render(field_view_value('node', $node, 'field_external_author', $field[0]));
?>
<?php
}
?>
</h5>
<?php
print render($content['body']);
?>
<a href="<?php
$field = field_get_items('node', $node, 'field_external_url');
print render(field_view_value('node', $node, 'field_external_url', $field[0]));
?>
" target="_blank">Read Original Article</a>
</div>
</div>
</article> <!-- /.node -->
开发者ID:akhattab-klipfolio,项目名称:Drupal-Git,代码行数:30,代码来源:node--coverage.tpl.php
示例7: node_load
* - $css_name: A css-safe version of the view name.
* - $css_class: The user-specified classes names, if any
* - $header: The view header
* - $footer: The view footer
* - $rows: The results of the view query, if any
* - $empty: The empty text to display if the view is empty
* - $pager: The pager next/prev links to display, if any
* - $exposed: Exposed widget form/info to display
* - $feed_icon: Feed icon to display, if any
* - $more: A link to view more, if any
*
* @ingroup views_templates
*/
$node = node_load($view->result[0]->nid);
$image = field_get_items('node', $node, 'field_block_image');
$body = field_get_items('node', $node, 'body');
?>
<div class="row block-wrapper">
<div class="large-7 columns body">
<?php
print render(field_view_value('node', $node, 'body', $body[0], array('label' => 'hidden')));
?>
</div>
<div class="large-5 columns image large-text-left medium-text-center small-text-center">
<?php
print render(field_view_value('node', $node, 'field_block_image', $image[0]));
?>
</div>
</div>
<div class="clearfix"></div>
开发者ID:rmyrup,项目名称:grameen-foundation,代码行数:30,代码来源:views-view--cm-home-subscribe.tpl.php
示例8: loop_preprocess_comment
/**
* Implements hook_preprocess_comment().
*
* Load user for every comment.
*/
function loop_preprocess_comment(&$variables)
{
// Make the content author object available.
$variables['comment']->account = user_load($variables['comment']->uid);
$variables['comment_author_name'] = _loop_fetch_full_name($variables['comment']->account);
$variables['comment_author_image'] = _loop_fetch_author_image($variables['comment']->account);
$variables['comment_body'] = _loop_fetch_comment_body($variables['comment']);
$comment_author = $variables['comment']->account;
if (is_object($comment_author)) {
// Load entity wrapper for author.
$wrapper = entity_metadata_wrapper('user', $comment_author);
// Fetch the fields needed.
$variables['place'] = $wrapper->field_location_place->value();
$fetched_job_title = field_get_items('user', $variables['comment']->account, 'field_job_title');
$variables['job_title'] = field_view_value('user', $variables['comment']->account, 'field_job_title', $fetched_job_title[0], array());
}
// Fetch files related to the comment.
if ($variables['node']->type == 'post') {
if (!empty($variables['field_file_upload_comment'])) {
$variables['files'] = _loop_fetch_files('comment', $variables['comment']);
}
}
$variables['content']['links']['abuse']['#attributes']['class'] = 'comment--links';
// Remove flag, delete, edit and reply links.
unset($variables['content']['links']['comment']['#links']['comment-delete']);
unset($variables['content']['links']['comment']['#links']['comment-edit']);
unset($variables['content']['links']['flag']);
unset($variables['content']['links']['comment']['#links']['comment-reply']);
}
开发者ID:faxe-kommune,项目名称:OS2loop,代码行数:34,代码来源:template.php
示例9: unity_lab_it_preprocess_node_software_title
function unity_lab_it_preprocess_node_software_title(&$vars, $hook)
{
$relatedNodeIds = $vars['field_computer_lab_nodes'];
$nodeIds = array();
foreach ($relatedNodeIds as $relatedNodeId) {
$nodeIds[] = $relatedNodeId['target_id'];
}
if (count($nodeIds) > 0) {
$relatedNodes = entity_load('node', $nodeIds);
$items = array();
foreach ($relatedNodes as $relatedNode) {
$logo = field_get_items('node', $relatedNode, 'field_logo');
if ($logo) {
$logo_render = field_view_value('node', $relatedNode, 'field_logo', $logo[0]);
//$logo_render['#item']["attributes"]["class"] = array('flat-circle-image');
$item['image'] = $logo_render;
} else {
$item['image'] = '';
}
$item['url'] = url('node/' . $relatedNode->nid);
$item['title'] = $relatedNode->title;
$rnIntroduction = field_get_items('node', $relatedNode, 'field_introduction');
$rnIntroduction = empty($rnIntroduction[0]['value']) ? '' : $rnIntroduction[0]['value'];
$item['introduction'] = $rnIntroduction;
$vars['content']['labs'][] = $item;
}
}
_unity_lab_paragraphs_item_column_classes($vars, $vars['content']['labs'], 1);
$view = views_get_view('related_kb_articles');
$output = $view->preview('block_3');
// At least in $view->result is the result.
if ($view->result) {
$vars['content']['faqView'] = $output;
}
if (arg(0) == 'node' && is_numeric(arg(1))) {
// creating the node variable
$node = node_load(arg(1), NULL, TRUE);
}
$reportProbURL = field_get_items('node', $node, 'field_report_a_problem_url');
$reportProbURL = empty($reportProbURL[0]['url']) ? '' : $reportProbURL[0]['url'];
if ($reportProbURL) {
$vars['content']['reportProbURL'] = $reportProbURL;
}
}
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:44,代码来源:template.php
示例10: field_get_items
<div class="col-lg-7">
<?php
$item = field_get_items('node', $node, 'body');
$body = field_view_value('node', $node, 'body', $item[0]);
print $body['#markup'];
?>
</div>
</div>
<?php
} else {
?>
<div class="row">
<div class="col-lg-12">
<?php
$item = field_get_items('node', $node, 'body');
$body = field_view_value('node', $node, 'body', $item[0]);
print $body['#markup'];
?>
</div>
</div>
<?php
}
?>
<?php
// Hide comments, tags, and links now so that we can render them later.
hide($content['comments']);
hide($content['links']);
hide($content['field_tags']);
?>
<?php
if (!empty($content['field_tags']) || !empty($content['links'])) {
开发者ID:verbruggenalex,项目名称:mediayoutubeupload,代码行数:31,代码来源:node--page--teaser.tpl.php
示例11: field_get_items
<h2><b>Related Publications</b></h2>
<div>
<?php
$field_store_reference = field_get_items('node', $node, 'field_docum_related_publications');
$render_array = field_view_value('node', $node, 'field_docum_related_publications', $field_store_reference[0]);
echo "<br>";
print render($render_array);
?>
</div>
<h2><b>Related Documents and Media</b></h2>
<div>
<?php
$field_store_reference = field_get_items('node', $node, 'field_docum_related_publications');
$render_array = field_view_value('node', $node, 'field_docum_related_publications', $field_store_reference[0]);
echo "<br>";
print render($render_array);
?>
</div>
<div class="des-bottom">
<b>Research Topics:</b>
<?php
// print render(field_view_field('node', $node, 'field_document_rits'));
?>
<br>
<b>National Strategic Program Areas:</b> Wildland Fire and Fuels<br>
<b>Priority Research Area: </b> Sxxxxxxxxxxxxx<br>
<b>PNW Research Programs: </b>
开发者ID:phpsubbarao,项目名称:test-core,代码行数:30,代码来源:page--documents.tpl.php
示例12: render
}
?>
<?php
}
?>
<?php
if (isset($content['sharethis'])) {
?>
<?php
print render($content['sharethis']);
?>
<?php
}
?>
</div>
<div class="w-col w-col-8">
<?php
foreach ($multimedia as $key => $value) {
$pid = $value['value'];
$data = field_view_value('node', $node, 'field_portfolio_multimedia', $multimedia[$key]);
?>
<?php
print render($data['entity']['field_collection_item'][$pid]['field_portfolio_multi_image']);
?>
<?php
}
?>
</div>
开发者ID:toptomatotwo,项目名称:tomwebdev,代码行数:31,代码来源:node--portfolio.tpl_orig.xxx.php
示例13: field_get_items
<?php
$image = '';
if (!empty($node->field_video)) {
$field_video = field_get_items('node', $node, 'field_video');
$field_custom_video_thumbnail = field_get_items('node', $node, 'field_custom_video_thumbnail');
if (!empty($field_custom_video_thumbnail[0]['uri'])) {
$image_item = array('style_name' => $thumb_image_style, 'path' => $field_custom_video_thumbnail[0]['uri'], 'alt' => $node->title, 'title' => $node->title);
$image = theme('image_style', $image_item);
} else {
$field_video_view_value = field_view_value('node', $node, 'field_video', $field_video[0]);
$field_video_view_value['#theme'] = 'video_formatter_thumbnail';
$field_video_view_value['#image_style'] = $thumb_image_style;
$image = render($field_video_view_value);
}
}
$node_url = url('node/' . $node->nid);
$name = bizutv_helper_get_user_name($node->uid);
$display_name = l($name, 'user/' . $node->uid);
$duration = bizutv_helper_get_duration($node->field_video['und'][0]['fid']);
$likes_display = '';
if ($likes) {
$rate_results = rate_get_results('node', $node->nid, 1);
$likes_display = $rate_results['up'];
}
$views_display = '';
if ($views) {
$hits = bizutv_video_get_node_hits($node->nid);
$views_display = $hits . ' view' . ($hits == 1 ? '' : 's');
}
$time_ago_display = '';
开发者ID:johnedelatorre,项目名称:fusion,代码行数:31,代码来源:bizutv-video-thumb.tpl.php
示例14: variable_get
size-<?php
print $banner_height_value;
?>
">
<div class="banner-image" style="<?php
$files_dir = variable_get('file_public_path', conf_path() . '/files');
if (!empty($field_image)) {
print 'background-image:url(/' . $files_dir . '/banners/' . $field_image[0]['filename'] . ');';
}
?>
">
<?php
if (!empty($field_banner_text)) {
?>
<div class="container label-wrapper">
<h2>
<?php
$field = field_get_items('node', $node, 'field_banner_text');
print render(field_view_value('node', $node, 'field_banner_text', $field[0]));
?>
</h2>
</div>
<?php
}
?>
</div>
</div>
开发者ID:akhattab-klipfolio,项目名称:Drupal-Git,代码行数:30,代码来源:node--nodeblock--banner-image.tpl.php
示例15: field_get_items
<?php
if (isset($content['field_gallery'])) {
//
?>
<?php
$images = field_get_items('node', $node, 'field_gallery');
?>
<?php
$gallery = array();
if ($images && !$is_front) {
foreach ($images as $img) {
$gallery[] = field_view_value('node', $node, 'field_gallery', $img, array('type' => 'image', 'settings' => array('image_style' => 'large')));
}
print render($galeria);
}
?>
<?php
}
} else {
print render($page['content']);
}
?>
</section>
</div>
开发者ID:pedrokoblitz,项目名称:drupal-ascom,代码行数:29,代码来源:page--node.tpl.php
示例16: field_get_items
<?php
$image = field_get_items('node', $node, 'field_image');
if ($image) {
$imgOutput = field_view_value('node', $node, 'field_image', $image[0], array('type' => 'image', 'settings' => array('image_style' => 'thumbnail')));
}
?>
<div class="col-">
<div id="node-article-list" class="node-article-list">
<h4>
<a href="<?php
print $node_url;
?>
">
<span class="data">
<?php
print format_date($node->created, 'custom', 'j/m/Y');
?>
</span>
<?php
print $title;
?>
</a>
</h4>
<p>
<a href="<?php
print $node_url;
开发者ID:pedrokoblitz,项目名称:drupal-ascom,代码行数:30,代码来源:node--article--list.tpl.php
示例17: field_get_items
<?php
// save fields to local variables
$item_hero_text = field_get_items('node', $node, 'field_hero_text');
$hero_text = field_view_value('node', $node, 'field_hero_text', $item_hero_text[0]);
// get link
$hero_link = field_get_items('node', $node, 'field_hero_link');
$link = $hero_link[0];
// get an image's URL
$item_hero_image = field_get_items('node', $node, 'field_hero_image');
$hero_image = $item_hero_image[0]['uri'];
$hero_image_url = file_create_url($hero_image);
$item_body = field_get_items('node', $node, 'body');
$body = field_view_value('node', $node, 'body', $item_body[0]);
$pathways = field_get_items('node', $node, 'field_pathways');
$item_video_section_text = field_get_items('node', $node, 'field_video_section_text');
$video_section_text = field_view_value('node', $node, 'field_video_section_text', $item_video_section_text[0]);
// get plain text
$item_overview_video = field_get_items('node', $node, 'field_youtube_embed_url');
$overview_video = $item_overview_video[0]['value'];
$related_pages = field_get_items('node', $node, 'field_related_pages');
$main_image = $hero_image_url;
$field_summary = field_view_field('node', $node, 'field_video_section_text', array('label' => 'hidden', 'type' => 'text_summary_or_trimmed', 'settings' => array()));
// give it a big clean out
$summary = html_entity_decode(preg_replace("/ /i", " ", htmlentities(strip_tags($field_summary[0]['#markup']))));
$summary = preg_replace('/"/', "'", $summary);
$summary = preg_replace("/(\r?\n){2,}/", ' ', $summary);
$inline_script = '' . '<meta property="og:title" content="' . variable_get('site_name', '') . ' – The University of Melbourne" />' . '<meta property="og:image" content="' . $main_image . '" />' . '<meta property="og:description" content="' . trim($summary) . '" />' . '<meta name="twitter:card" content="summary" />' . '<meta name="twitter:site" content="@msdsocial" />' . '<meta name="twitter:creator" content="@msdsocial" />' . '';
$element = array('#type' => 'markup', '#markup' => $inline_script);
drupal_add_html_head($element, 'fb ogs');
?>
开发者ID:patpaev,项目名称:benvs15,代码行数:30,代码来源:node--home-page.tpl.php
示例18: mos_getFieldCollectionValue
/**
* Loads a drupal field collection in a single function call
*
* @author Arika Prime
* @param string $fieldCollectionName drupal field collection machine name
* @param object $node is teh node object - leave null for current node.
* @return mixed[] The value of the field collection. This will return value in the order that they are entered in Drupal Admin
*/
function mos_getFieldCollectionValue($fieldCollectionName, $node = null)
{
$node = mos_node($node);
$valueArray = array();
$fieldCollection = field_get_items('node', $node, $fieldCollectionName);
if (!empty($fieldCollection)) {
foreach ($fieldCollection as $fieldCollectionKey => $fieldCollectionValue) {
$field = field_view_value('node', $node, $fieldCollectionName, $fieldCollectionValue);
$fieldName = array();
// Parse array to pull out the field labels of the fields within the field collection
$fieldCollectionItemIndex = $fieldCollectionKey + 1;
foreach ($field['entity']['field_collection_item'] as $id => $fieldCollection) {
foreach ($fieldCollection as $key => $value) {
if (!preg_match("/\\#/", $key)) {
$fieldName[] = $key;
}
}
// load the field collection item entity
$fieldCollectionItem = field_collection_item_load($id);
// wrap the entity and make it easier to get the values of fields
$fieldWrapper = entity_metadata_wrapper('field_collection_item', $fieldCollectionItem);
// store values in array which will be returned at end of function
foreach ($fieldName as $index => $name) {
$valueArray[$fieldCollectionKey][$name] = $fieldWrapper->{$name}->value();
}
}
}
}
return $valueArray;
}
开发者ID:bonniebo421,项目名称:subsites,代码行数:38,代码来源:template-functions.php
示例19: foreach
<div class="tfa-block">
<h3>Random From Categories</h3>
<div id="tfa-owl" class="owl-carousel">
<?php
foreach ($vars as $var) {
$node = node_load($var->nid);
$files = field_get_items('node', $node, 'field_parent_list_slide_image');
if (!empty($files)) {
foreach ($files as $keys => $value) {
$imageOutput = field_view_value('node', $node, 'field_parent_list_slide_image', $files[$keys], array('type' => 'image', 'settings' => array('image_style' => 'main_factsthumb', 'image_link' => 'content')));
}
}
?>
<div class="item">
<article class="tfa-block tfa-block-article">
<figure>
<div class="tfa-article-link-overlay">
<?php
echo l('', 'node/' . $node->nid, array('attributes' => array('class' => array('tfa-icon', 'tfa-icon-link'))));
?>
</div>
开发者ID:binodlamsal,项目名称:factsdrupal,代码行数:30,代码来源:list_random_content.tpl.php
示例20: foreach
.slick-prev:before, .slick-next:before {
font-size: 40px;
color: greenyellow; /*to notice it, is white*/
}
.slick-prev {
left: 40px;
}
.slick-next {
right: 40px;
}
</style>
<div class="homepage-slider">
<?php
foreach ($slides as $slide) {
?>
<div>
<?php
$image = field_get_items('node', $slide, 'field_image');
$output = field_view_value('node', $slide, 'field_image', $image[0], array('type' => 'image', 'settings' => array('image_style' => 'slider_homepage')));
echo render($output);
?>
</div>
<?php
}
?>
</div>
开发者ID:nyl-auster,项目名称:meghann,代码行数:30,代码来源:slider_homepage.tpl.php
注:本文中的field_view_value函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论