本文整理汇总了PHP中field_view_field函数的典型用法代码示例。如果您正苦于以下问题:PHP field_view_field函数的具体用法?PHP field_view_field怎么用?PHP field_view_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了field_view_field函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: templateName_preprocess_page
function templateName_preprocess_page(&$vars, $hook)
{
//*************************************
// If the node type is "blog_madness" the template suggestion will be "page--blog-madness.tpl.php".
//*************************************
if (isset($vars['node'])) {
$vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
}
//*******************************
// rendu d'un field dans une page
//*******************************
if (isset($vars['node'])) {
if ($vars['node']->type == 'node' or 'nodetype' or 'foo') {
$node = node_load($vars['node']->nid);
$output = field_view_field('node', $node, 'field_name_of_field', array('label' => 'hidden'));
$vars['field_name_of_field'] = $output;
}
}
/**** DANS LE TPL.PHP -->
<?php if ($field_name_of_field):
print render($field_name_of_field);
endif;?>
*****/
}
示例2: gitp_page_alter
function gitp_page_alter(&$page)
{
if (arg(0) == 'node' && is_numeric(arg(1))) {
$nid = arg(1);
$node = node_load($nid);
switch ($node->type) {
case 'resources':
$page['content_bottom'][] = field_view_field('node', $node, 'field_resources', 'full');
unset($page['content']['system_main']['nodes'][$nid]['field_resources']);
break;
case 'news':
break;
default:
}
}
if (isset($page['content']['system_main']['term_heading'])) {
// This is a taxonomy term page
if ($page['content']['system_main']['term_heading']['term']['#entity_type'] == 'taxonomy_term') {
$page['content_bottom']['system_main']['nodes'] = $page['content']['system_main']['nodes'];
$page['content_bottom']['system_main']['pager'] = $page['content']['system_main']['pager'];
unset($page['content']['system_main']['nodes']);
unset($page['content']['system_main']['pager']);
}
}
}
示例3: accessDetails
/**
* Implements CommerceLicenseInterface::accessDetails().
*/
public function accessDetails()
{
// Display the files.
$product = $this->wrapper->product->value();
$display = array('label' => 'hidden', 'type' => 'commerce_file', 'settings' => array('check_access' => FALSE));
$output = field_view_field('commerce_product', $product, 'commerce_file', $display);
return drupal_render($output);
}
示例4: viewValues
public static function viewValues($entity_type, $entity, $field_name, $display = array(), $langcode = NULL)
{
if (module_exists('render_cache') && function_exists('render_cache_view_field')) {
return render_cache_view_field($entity_type, $entity, $field_name, $display, $langcode);
} else {
return field_view_field($entity_type, $entity, $field_name, $display, $langcode);
}
}
示例5: fieldView
public function fieldView($node, $field, $view_mode = 'default')
{
if (!$node instanceof NodeInterface) {
return '';
}
if (!field_get_items('node', $node, $field)) {
return '';
}
$output = field_view_field('node', $node, $field, $view_mode);
return drupal_render($output);
}
示例6: data
public function data($parms = array())
{
$nid = isset($parms['nid']) ? $parms['nid'] : 1;
$vid = isset($parms['vid']) ? $parms['vid'] : NULL;
// No node ID means don't try and laod a node.
if (!$nid && !$vid) {
return '';
}
$node = node_load($nid, $vid);
$return = new SimpleXMLElement('<node/>');
$lang = isset($node->language) ? $node->language : 'und';
$display = isset($parms['display']) ? $parms['display'] : 'default';
if ($node) {
foreach ($node as $key => $val) {
if ($val) {
if (strpos($key, 'field_') === 0) {
//$fields = field_get_items('node', $node, $key);
$field = field_view_field('node', $node, $key, $display);
$field['#theme'] = array('forena_inline_field');
$value = drupal_render($field);
$f = $return->addChild($key, $value);
if (isset($field['#field_type'])) {
$f['type'] = $field['#field_type'];
}
if (isset($field['#field_name'])) {
$f['name'] = $field['#field_name'];
}
} else {
if (is_array($val) && isset($val[$lang])) {
$tmp = $val[$lang][0];
if (isset($tmp['safe_value'])) {
$return->addChild($key, $tmp['safe_value']);
} else {
if (isset($tmp['value'])) {
$return->addChild($key, $tmp['value']);
}
}
} else {
if (is_scalar($val)) {
$return->addChild($key, $val);
}
}
}
}
}
}
return $return;
}
示例7: cami_preprocess_page
function cami_preprocess_page(&$vars)
{
if (isset($vars['node'])) {
$vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
}
//404 page
$status = drupal_get_http_header("status");
if ($status == "404 Not Found") {
$vars['theme_hook_suggestions'][] = 'page__404';
}
if (isset($vars['node'])) {
//print $vars['node']->type;
if ($vars['node']->type == 'page') {
$node = node_load($vars['node']->nid);
$output = field_view_field('node', $node, 'field_show_page_title', array('label' => 'hidden'));
$vars['field_show_page_title'] = $output;
//sidebar
$output = field_view_field('node', $node, 'field_sidebar', array('label' => 'hidden'));
$vars['field_sidebar'] = $output;
}
}
}
示例8: adopted_preprocess_page
function adopted_preprocess_page(&$vars)
{
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;
}
if (!empty($vars['node'])) {
$node = $vars['node'];
$og_title = array('#tag' => 'meta', '#attributes' => array('property' => 'og:title', 'content' => $node->title));
$keyword = array('#tag' => 'meta', '#attributes' => array('name' => 'keywords', 'content' => $node->title));
drupal_add_html_head($og_title, 'og_title');
drupal_add_html_head($keyword, 'keyword');
if ($node->type == 'article' || $node->type == 'article') {
$img = field_get_items('node', $vars['node'], 'field_image');
$img_url = file_create_url($img[0]['uri']);
$og_image = array('#tag' => 'meta', '#attributes' => array('property' => 'og:image', 'content' => $img_url));
drupal_add_html_head($og_image, 'og_image');
}
if ($node->type == 'product') {
$img = $node->field_product_images['und'][0]['uri'];
$img_url = file_create_url($img);
$og_image = array('#tag' => 'meta', '#attributes' => array('property' => 'og:image', 'content' => $img_url));
drupal_add_html_head($og_image, 'og_image');
}
$body_field = field_view_field('node', $vars['node'], 'body', array('type' => 'full_html'));
$body_field_stripped = strip_tags($body_field[0]['#markup']);
// remove html element, so facebook post clear.
$og_description = array('#tag' => 'meta', '#attributes' => array('property' => 'og:description', 'content' => text_summary($body_field_stripped)));
drupal_add_html_head($og_description, 'og_description');
}
}
示例9: render
*/
?>
<article id="node-<?php
print $node->nid;
?>
" class="<?php
print $classes;
?>
clearfix"<?php
print $attributes;
?>
>
<div class="node-featured">
<?php
if (!empty($field_featured)) {
print render(field_view_field('node', $node, 'field_featured', array('settings' => array('image_style' => 'featured'))));
}
?>
<?php
if (!empty($title)) {
?>
<h2<?php
print $title_attributes;
?>
><a href="<?php
print $node_url;
?>
"><?php
print $title;
?>
</a></h2>
示例10: hide
>
<?php
// We hide the comments and links now so that we can render them later.
hide($content);
hide($content['comments']);
hide($content['links']);
//print render($content);
?>
<?php
print render($content['field_image']);
?>
<?php
if (isset($content['field_event_term'])) {
$term = taxonomy_term_load($node->field_event_term['und'][0]['tid']);
$image_field = field_view_field('taxonomy_term', $term, 'field_image');
$term_tid = $term->tid;
}
?>
<div class="img-tag">
<a href="/taxonomy/term/<?php
print $term_tid;
?>
">
<?php
print render($image_field);
?>
</a>
</div>
<?php
示例11: set_items
/**
* Return an array of items for the field.
*/
function set_items($values, $row_id)
{
// In some cases the instance on the entity might be easy, see
// https://drupal.org/node/1161708 and https://drupal.org/node/1461536 for
// more information.
if (empty($values->_field_data[$this->field_alias]) || empty($values->_field_data[$this->field_alias]['entity']) || !isset($values->_field_data[$this->field_alias]['entity']->{$this->definition['field_name']})) {
return array();
}
$display = array('type' => $this->options['type'], 'settings' => $this->options['settings'], 'label' => 'hidden', 'views_view' => $this->view, 'views_field' => $this, 'views_row_id' => $row_id);
$entity_type = $values->_field_data[$this->field_alias]['entity_type'];
$entity = $this->get_value($values, 'entity');
if (!$entity) {
return array();
}
$langcode = $this->field_language($entity_type, $entity);
if (empty($langcode)) {
$langcode = LANGUAGE_NONE;
}
$multifield_items = field_get_items($entity_type, $entity, $this->definition['field_name'], $langcode);
if (is_array($multifield_items)) {
array_walk($multifield_items, 'multifield_item_unserialize', multifield_extract_multifield_machine_name($this->multifield_info));
} else {
$multifield_items = array();
}
$render_array = array();
foreach ($multifield_items as $multifield_item) {
$multifield = _multifield_field_item_to_entity(multifield_extract_multifield_machine_name($this->multifield_info), $multifield_item);
$subfield_langcode = $this->field_language('multifield', $multifield);
if (empty($render_array)) {
$render_array = field_view_field('multifield', $multifield, $this->definition['subfield_name'], $display, $subfield_langcode);
} else {
$subfield_render_array = field_view_field('multifield', $multifield, $this->definition['subfield_name'], $display, $subfield_langcode);
// Multifield subfields are always single value.
$render_array[] = $subfield_render_array[0];
}
}
$items = array();
if ($this->options['field_api_classes']) {
// Make a copy.
$array = $render_array;
return array(array('rendered' => drupal_render($render_array)));
}
foreach (element_children($render_array) as $count) {
$items[$count]['rendered'] = $render_array[$count];
// field_view_field() adds an #access property to the render array that
// determines whether or not the current user is allowed to view the
// field in the context of the current entity. We need to respect this
// parameter when we pull out the children of the field array for
// rendering.
if (isset($render_array['#access'])) {
$items[$count]['rendered']['#access'] = $render_array['#access'];
}
// Only add the raw field items (for use in tokens) if the current user
// has access to view the field content.
if ((!isset($items[$count]['rendered']['#access']) || $items[$count]['rendered']['#access']) && !empty($render_array['#items'][$count])) {
$items[$count]['raw'] = $render_array['#items'][$count];
}
}
return $items;
}
示例12: hide
*/
if (strpos($classes, 'node-unpublished')) {
print '<div class="unpublished-alert ' . $classes . '">Unpublished</div>';
}
// We hide the comments and links now so that we can render them later.
hide($content['comments']);
hide($content['links']);
hide($content['field_show_right_rail']);
hide($content['field_right_rail_content']);
hide($content['field_page_type']);
hide($content['field_software']);
hide($content['field_uses_subtheme']);
hide($content['field_subtheme']);
print render($content);
/**
* PRINT THE RIGHT-RAIL IF CONTENT EXISTS
*/
if (!empty($content['field_right_rail_content'][0]) && $content['field_show_right_rail']['#items']['0']['value'] == '1') {
?>
</div>
<div id="right-rail">
<div class="right-rail-content">
<?php
print render(field_view_field('node', $node, 'field_right_rail_content', array('label' => 'hidden')));
?>
</div>
</div>
<?php
} else {
print "</div>";
}
示例13: list
<div class="images"><?php
list($items) = field_get_items('node', $node, 'field_image');
$style = array('path' => $items['uri'], 'style_name' => 'slideshow');
echo theme('image_style', $style);
?>
</div>
<div class="desc text-left hidden-xs" <?php
if (!variable_get('zdigital_slideshow_hide_text', 1)) {
echo 'style="display:none"';
}
?>
>
<div style="width: 75%"><h3><?php
echo $node->title;
?>
</h3>
<?php
$view = field_view_field('node', $node, 'body');
echo render($view);
?>
</div>
</div>
</li>
<?php
}
?>
</ul>
</div>
<div class="sl_controller"></div>
</div>
示例14: render
echo $base_path;
?>
sites/all/themes/bootstrap_sauvages/image/photo/mini-guide-couv.jpg" alt="Couverture du livre Sauvages de ma rue" /></a>
</div>
<div class="span9">
<h2>Le mini-guide à construire soi-même</h2>
<p class="sous-lead">Le mini-guide <strong>Sauvages de PACA</strong> présente les <strong>12 plantes sauvages</strong> les plus fréquemment rencontrées dans les rues de la région PACA.</p>
<p class="sous-lead">Construisez-le vous même et parcourez les rues, mini-guide en poche.</p>
<?php
if (!empty($node->field_fichier_telecharger)) {
?>
<?php
//$field = field_view_field('node', $node, 'field_fichier_telecharger');
?>
<?php
$output_fft = render(field_view_field('node', $node, 'field_fichier_telecharger', array('label' => 'hidden')));
?>
<div class="btn">
<span class="">Télécharger le Mini-guide </span>
<?php
echo $output_fft;
?>
<span class="filesize"><?php
print format_size($node->field_fichier_telecharger['und'][0]['filesize']);
?>
</span>
</div>
<?php
}
?>
示例15: render
<input type="text" id="asset" name="asset" size="50" placeholder="Asset" data-init="Asset" class="init" /><br /><br />
<input type="file" id="file" name="file" size="50" class="init" /><br /><br />
<input type="submit" value="Add Asset"/>
</form>
</div>
</div>
<div id="resources-wrapper" class="right-wrapper">
<div id="resources-container"><?php
print render($content['field_resources']);
?>
</div>
--- Project Resources ---<br /><br />
<?php
$f = field_view_field('node', $project, 'field_resources', array('label' => 'hidden'));
print render($f);
?>
<a href="#" id="add-resource" onclick="jQuery('#node-add-resource').toggle(); return false;" class="form-link">Add Resource</a>
<div id="node-add-resource" class="hidden-form">
<form action="#"
id="resource-form"
onsubmit=" jQuery('#resources-container').load('/stories/update-resources/add', {data: jQuery('#resource-form').serialize()},function(){work_log.update_log(<?php
print $node->nid;
?>
);});
jQuery('#node-add-resource').hide();
reset_height();
return false;">
<input type="hidden" id="nid" name="nid" value="<?php
print $node->nid;