Skip to content

Instantly share code, notes, and snippets.

@amitsedai
Created August 12, 2014 11:40
Show Gist options
  • Save amitsedai/9c67c3bd8f10743a55f3 to your computer and use it in GitHub Desktop.
Save amitsedai/9c67c3bd8f10743a55f3 to your computer and use it in GitHub Desktop.
Alter field title of content type to display description below the field title
<?php
function ji_custom_node_view($node, $view_mode, $langcode) {
if($view_mode != 'full'){
return;
}
switch ($node->type) {
case 'blood_donor_form':
foreach ($node->content as $field_name => $field_options) {
if(isset($field_options['#title']) && isset($field_options[0]['markup'])) {
$node->content["$field_name"]['#title'] = $field_options['#title']
."<div class = 'ji-field-description-suffix'>".$field_options[0]['markup']['#suffix']."</div>";
unset($node->content["$field_name"][0]['markup']['#suffix']);
}
}
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment