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;?> *****/ }
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']); } } }
/** * 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); }
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); } }
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); }
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; }
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; } } }
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'); } }
*/ ?> <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>
> <?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
/** * 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; }
*/ 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>"; }
<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>
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 } ?>
<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;
function heshel_preprocess_page(&$vars) { if (isset($vars['node'])) { $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type; } if (isset($vars['node'])) { $vars['theme_hook_suggestions'][] = 'page__node__' . $vars['node']->nid; } //404 page $status = drupal_get_http_header("status"); if ($status == "404 Not Found") { $vars['theme_hook_suggestions'][] = 'page__404'; } if (isset($vars['node'])) { if ($vars['node']->type == 'biblio') { $vars['theme_hook_suggestions'][] = 'page__biblio'; //drupal_add_js(path_to_theme().'/js/related_load.js'); } } if (isset($vars['node'])) { 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; } } }
<?php } ?> <?php print render($content['body']); ?> </div> <div class="node-sidebar col-md-3"> <?php if (!empty($node->field_image)) { ?> <?php print render(field_view_field('node', $node, 'field_image', array('settings' => array('image_style' => 'mainimage')))); ?> <?php } ?> </div> </div> </div> </div> </div> <?php } ?> </article> <?php
function dandeleon_preprocess_block(&$vars, $hook) { // Add a striping class. global $base_url; $vars['classes_array'][] = 'block-' . $vars['zebra']; if ($vars['block_html_id'] == 'block-easy-breadcrumb-easy-breadcrumb') { $node = menu_get_object(); if ($node != null) { //dpm($node); if ($node->type == 'paquete_compuesto') { $breadcrumb = array(array('content' => 'Inicio', 'class' => array('easy-breadcrumb_segment', 'easy-breadcrumb_segment-front'), 'url' => '<front>'), array('content' => $node->title, 'class' => array('easy-easy-breadcrumb_segment', 'easy-breadcrumb_segment-title'))); $url = ''; $name = ''; $query = db_query('SELECT v.value FROM {variable} v WHERE v.name = :cn', array(':cn' => 'category_name')); if ($query->rowCount() != 0) { foreach ($query as $value) { //var_export($value->value); $datos_sesion = unserialize($value->value); $name = (string) $datos_sesion; } } $query2 = db_query('SELECT v.value FROM {variable} v WHERE v.name = :cn', array(':cn' => 'category_url')); if ($query2->rowCount() != 0) { foreach ($query2 as $value2) { //var_export($value->value); $datos_sesion = unserialize($value2->value); $url = (string) $datos_sesion; } } if ($name == 'none') { //buscar la primera categoria del nodo $field = field_view_field('node', $node, 'field_paquete_economico'); $name = $field['#items'][0]['taxonomy_term']->name; $taxonomy_id = $field['#items'][0]['taxonomy_term']->tid; $url = drupal_lookup_path('alias', 'taxonomy/term/' . $taxonomy_id); } else { //obtener el termino id de la categoria $taxonomy = drupal_lookup_path('source', $url); $arrayTaxonomy = explode('/', $taxonomy); $term = taxonomy_term_load($arrayTaxonomy[2]); $taxonomy_id = $term->tid; } $vars['elements']['easy_breadcrumb']['#breadcrumb'] = $breadcrumb; $content = '<div class="easy-breadcrumb"> <a href="/" class="easy-breadcrumb_segment easy-breadcrumb_segment-front">Inicio</a> <span class="easy-breadcrumb_segment-separator"> / </span> <a href="/catalogo-de-viajes-en-oferta" class="easy-breadcrumb_segment easy-breadcrumb_segment-1">Catálogo de viajes en oferta</a> <span class="easy-breadcrumb_segment-separator"> / </span> <a href="' . $base_url . '/' . $url . '" class="easy-breadcrumb_segment easy-breadcrumb_segment-2">' . $name . '</a> <span class="easy-breadcrumb_segment-separator"> / </span> <span class="easy-breadcrumb_segment easy-breadcrumb_segment-title">' . $node->title . '</span> </div>'; $vars['content'] = $content; } } } }
function unity_lab_it_preprocess_node_workshop_event(&$vars, $hook) { $workshop = field_get_items('node', $vars['node'], 'field_workshop'); if (!empty($workshop[0]['target_id'])) { $workshop = node_load($workshop[0]['target_id']); $vars['content']['field_contact'] = field_view_field('node', $workshop, 'field_contact', 'default'); $vars['content']['field_request_link'] = field_view_field('node', $workshop, 'field_request_link', 'default'); $vars['content']['field_related_nodes'] = field_view_field('node', $workshop, 'field_related_nodes', 'default'); $vars['content']['field_workshop_categories'] = field_view_field('node', $workshop, 'field_workshop_categories', 'default'); } }
?> <div class="gallery"> <?php for ($row = 0; $row < $rows; $row++) { ?> <div class="row"> <?php for (; $index < $n; $index++) { ?> <?php $item = $items[$index]; $revision_id = $item['revision_id']; $gallery_item = paragraphs_item_revision_load($revision_id); $gallery_item_wrapper = entity_metadata_wrapper('paragraphs_item', $gallery_item); $title = $gallery_item_wrapper->field_title->value(); $image = field_view_field('paragraphs_item', $gallery_item, 'field_image', 'gallery_image'); ?> <div class="col-md-<?php print $colspan; ?> text-center"> <div class="img-thumbnail text-center"> <?php print render($image); ?> <span class=""> <?php print $title; ?> </span>
public function viewNumberInteger($field_name, $view_mode = 'full', $post_process = TRUE, $from_entity_view = FALSE) { if ($from_entity_view) { $view = $this->view($view_mode); if (!empty($view[$field_name])) { $view = $view[$field_name]; } } else { $view = field_view_field($this->entity_type, $this->entity, $field_name, $view_mode, NULL); } if (!$post_process) { return $view; } $output = array(); foreach (element_children($view) as $key) { $output[] = $view[$key]['#markup']; } if (sizeof($output) == 1) { return $output[0]; } return $output; }
<div class="left citation"> <h3>CITATION INFORMATION</h3> <?php print render(field_view_field('node', $node, 'field_citationinformation')); ?> </div> <?php } ?> <?php if (!empty($node->field_relatedgbifresources)) { ?> <div class="left citation"> <h3>RELATED GBIF RESOURCES</h3> <?php print render(field_view_field('node', $node, 'field_relatedgbifresources')); ?> </div> <?php } ?> </div> <footer></footer> </article> <article class="next_news"> <header></header> <div class="content"> <h3>NEXT FEATURED DATA USE</h3> <h3 class="pn_node"><?php
} ?> </td> </tr> <?php if (isset($content['opigno_iht_status']['#title'])) { ?> <tr> <td class="vertical-header"> <?php print t($content['opigno_iht_status']['#title']); ?> </td> <td class="second_td"> <?php print t(render(field_view_field('node', $node, 'opigno_iht_status', array('label' => 'hidden')))); ?> </td> </tr> <?php } ?> <tr> <td class="vertical-header"> <?php print t('Duration'); ?> </td> <td class="second_td"> <?php $time = strtotime($node->opigno_calendar_date['und'][0]['value']);
</ol> <div class="carousel-inner"> <?php foreach ($items as $index => $item) { ?> <?php $active = $index == 0 ? 'active' : ''; $revision_id = $item['revision_id']; $photo = paragraphs_item_revision_load($revision_id); $photo_wrapper = entity_metadata_wrapper('paragraphs_item', $photo); $title = $photo_wrapper->field_title->value(); $raw_image_uri = $photo_wrapper->field_image->raw()['uri']; $raw_image_url = file_create_url($raw_image_uri); $image_url = image_style_url('slide_image', $raw_image_uri); $image = field_view_field('paragraphs_item', $photo, 'field_image', 'slide_image'); ?> <div class="item slides <?php print $active; ?> " style="background-image: url(<?php print $image_url; ?> );"> <div class="slide-<?php print $index; ?> "></div> <div class="item-content">
/** * Alter replacement values for placeholder tokens. * * @param $replacements * An associative array of replacements returned by hook_tokens(). * @param $context * The context in which hook_tokens() was called. An associative array with * the following keys, which have the same meaning as the corresponding * parameters of hook_tokens(): * - 'type' * - 'tokens' * - 'data' * - 'options' * * @see hook_tokens() */ function hook_tokens_alter(array &$replacements, array $context) { $options = $context['options']; if (isset($options['language'])) { $url_options['language'] = $options['language']; $language_code = $options['language']->language; } else { $language_code = NULL; } $sanitize = !empty($options['sanitize']); if ($context['type'] == 'node' && !empty($context['data']['node'])) { $node = $context['data']['node']; // Alter the [node:title] token, and replace it with the rendered content // of a field (field_title). if (isset($context['tokens']['title'])) { $title = field_view_field('node', $node, 'field_title', 'default', $language_code); $replacements[$context['tokens']['title']] = drupal_render($title); } } }
print $testimonial->nid; ?> /edit?destination=node/110">Edit Testimonial</a> </li> </ul> </div> <?php } ?> <i class="fa fa-quote-left"></i> <h2><?php print $testimonial->title; ?> </h2> <?php $body = field_view_field('node', $testimonial, 'body', array('label' => 'hidden')); print drupal_render($body); ?> <p class="name">– <strong><?php print $testimonial->field_testimonial_author[LANGUAGE_NONE][0]['value']; ?> </strong> <span>(<?php print $testimonial->field_testimonial_location[LANGUAGE_NONE][0]['value']; ?> )</span></p> </div> </figure> <?php } ?> <?php
/** * Implements hook_page_alter(). */ function ec_resp_page_alter(&$page) { global $language; if (arg(0) == 'node') { $node = node_load(arg(1)); if (isset($node->title)) { $node_title = filter_xss($node->title); } } $description = filter_xss(variable_get('site_slogan')); if (empty($description)) { $description = filter_xss(variable_get('site_name')); } if (!empty($node)) { $description = $node_title . ' - ' . $description; } if (theme_get_setting('enable_interinstitutional_theme')) { $title = t('EUROPA - !title', array('!title' => filter_xss(variable_get('site_name')))); } else { $title = t('!title - European Commission', array('!title' => filter_xss(variable_get('site_name')))); } if (!empty($node)) { // If the metatag title exists, it must be used to construct the title page. if (isset($node->field_meta_title) && !empty($node->field_meta_title)) { $title = filter_xss($node->field_meta_title['und'][0]['value']); } else { $title = $node_title . ' - ' . $title; } } $keywords = ''; if (!empty($node) && !empty($node->field_tags)) { $tags = field_view_field('node', $node, 'field_tags'); if (isset($tags['#items'])) { foreach ($tags['#items'] as $key => $value) { $keywords .= $value['taxonomy_term']->name . ', '; } } } $keywords .= filter_xss(variable_get('site_name')) . ', '; $keywords .= t('European Commission, European Union, EU'); $type = 'website'; if (!empty($node)) { $type = $node->type; } if (!module_exists('nexteuropa_metatags')) { // Content-Language. $meta_content_language = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('http-equiv' => 'Content-Language', 'content' => $language->prefix)); drupal_add_html_head($meta_content_language, 'meta_content_language'); // Description. $meta_description = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'description', 'content' => $description)); drupal_add_html_head($meta_description, 'meta_description'); // Reference. $meta_reference = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'reference', 'content' => filter_xss(variable_get('site_name')))); drupal_add_html_head($meta_reference, 'meta_reference'); // Creator. $meta_creator = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'creator', 'content' => 'COMM/DG/UNIT')); drupal_add_html_head($meta_creator, 'meta_creator'); } // IPG classification. $classification = variable_get('meta_configuration', 'none'); if ($classification != 'none') { if (!module_exists('nexteuropa_metatags')) { $meta_classification = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'classification', 'content' => variable_get('meta_configuration', 'none'))); drupal_add_html_head($meta_classification, 'meta_classification'); } } else { if (user_access('administer site configuration')) { $link = l(t('here'), 'admin/config/system/site-information'); $args = array('!link' => $link); drupal_set_message(t('Please select the IPG classification of your site !link.', $args), 'warning'); } } if (!module_exists('nexteuropa_metatags')) { // Keywords. $meta_keywords = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'keywords', 'content' => $keywords)); drupal_add_html_head($meta_keywords, 'meta_keywords'); // Date. $meta_date = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'date', 'content' => format_date(time(), 'custom', 'd/m/Y'))); drupal_add_html_head($meta_date, 'meta_date'); // Og title. $meta_og_title = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('property' => 'og:title', 'content' => $title)); drupal_add_html_head($meta_og_title, 'meta_og_title'); // Og type. $meta_og_type = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('property' => 'og:type', 'content' => $type)); drupal_add_html_head($meta_og_type, 'meta_og_type'); // Og site name. $meta_og_site_name = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('property' => 'og:site_name', 'content' => filter_xss(variable_get('site_name')))); drupal_add_html_head($meta_og_site_name, 'meta_og_site_name'); // Og description. $meta_og_description = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('property' => 'og:description', 'content' => $description)); drupal_add_html_head($meta_og_description, 'meta_og_description'); // Fb admins. $meta_fb_admins = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('property' => 'fb:admins', 'content' => 'USER_ID')); drupal_add_html_head($meta_fb_admins, 'meta_fb_admins'); // Robots. $meta_robots = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('property' => 'robots', 'content' => 'follow,index')); drupal_add_html_head($meta_robots, 'meta_robots'); // Revisit after. $revisit_after = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('property' => 'revisit-after', 'content' => '15 Days')); drupal_add_html_head($revisit_after, 'revisit-after'); // Viewport. $viewport = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0')); drupal_add_html_head($viewport, 'viewport'); } }
* * @see template_preprocess() * @see template_preprocess_node() * @see template_process() * * @ingroup themeable */ if ($teaser) { ?> <div class="item item-node"> <div class="item-title"><?php echo $node->title; ?> </div> <div class="item-body"><?php print render(field_view_field('node', $node, 'body')); ?> </div> </div> <?php } else { ?> <div class="alert alert-block alert-success" id="pnl-node-edit-success"> <a class="close" data-dismiss="alert" href="#">×</a> <h4 class="element-invisible">Status message</h4> <span class="msg-body"></span> </div> <div class="alert alert-block alert-danger" id="pnl-node-edit-error"> <a class="close" data-dismiss="alert" href="#">×</a> <h4 class="element-invisible">Status message</h4> <span class="msg-body"></span>
?> </div> <h2 class="node-title"><a href="<?php print $node_url; ?> " title="<?php print $title; ?> "><?php print $title; ?> </a></h2> <div class="content"> <p> <?php print render(field_view_field('node', $node, 'body', array('label' => 'hidden', 'type' => 'text_summary_or_trimmed', 'settings' => array('trim_length' => 150)))); ?> </p> </div> <div class="button"><?php print render($content["og_count_entity_view_1"]); ?> </div> </article> <?php } else { ?> <article id="node-<?php print $node->nid;
<?php // save fields to local variables $item_body = field_get_items('node', $node, 'body'); $body = $item_body[0]['value']; $field_summary = field_view_field('node', $node, 'field_summary', 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="' . drupal_get_title() . '" />' . '<meta property="og:image" content="/default.jpg" />' . '<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'); ?> <?php echo $body;