Created
August 12, 2014 11:40
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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