Created
March 20, 2012 05:05
-
-
Save barraponto/2131544 to your computer and use it in GitHub Desktop.
D6: How to modify the #theme and #formatter of a field based on build_mode
This file contains hidden or 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
| /** | |
| * Implements hook_nodeapi(). | |
| */ | |
| function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { | |
| if ($op == 'view') { | |
| if ($node->type == 'business' && $node->build_mode == 'mobile') { | |
| // change the field_photos formatter | |
| foreach ($node->content['field_photos']['field']['items'] as $key => $item) { | |
| $node->content['field_photos']['field']['items'][$key]['#formatter'] = 'my_preset_imagelink'; | |
| $node->content['field_photos']['field']['items'][$key]['#theme'] = 'imagecache_formatter_my_preset_imagelink'; | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment