field - Drupal 7 alter node display -
i have content type 2 image fields, banner , logo.
i trying implement logic allow 1 of 2 display depending on whether editor elected display banner or logo radio button options.
i setup little custom module implementing hook_node_view , tried unset image field node object no joy. code fragment below:
function mymodule_node_view($node, $view_mode, $langcode){ unset($node->field_main_picture[$node->language][0]); unset($node->field_main_picture); $node->field_main_picture = null; } none of attempts worked.
any suggestions, please?
i found reply question.
the node object contains array called content renderable info drupal print screen. it's in array unsets need take place. i.e:
unset($node->content['field_main_picture']); and main image image disappears.
drupal-7 field alter unset
No comments:
Post a Comment