123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- // dsm($vars);
- $node = $vars['node'];
- // $classes = array();
- $vars['classes_array'][] = 'node-'.$node->nid;
- // $vars['classes_array'][] = 'node type-'.$node->type;
- $vars['classes_array'][] = 'vm-'.$vars['view_mode'];
- // $classes[] = 'node-' . $vars['type'] . '-' . $vars['view_mode'];
- if($vars['sticky'])
- $vars['classes_array'][] = "sticky";
- if (!$vars['status'])
- $vars['classes_array'][] = "unpublished";
- if (isset($vars['flags']))
- $vars['classes_array'][] = "flaged";
- // $vars['classes_array'][] = $hook.' '.$hook.'-'.$vars['zebra'];
- if (isset($vars['workflow']))
- $vars['classes_array'][] = "workflow-".$vars['workflow'];
- $vars['theme_hook_suggestions'][] = 'node__'.$vars['view_mode'];
- $vars['theme_hook_suggestions'][] = 'node__' . $vars['type'] . '__' . $vars['view_mode'];
- if($vars['view_mode'] == 'bookmark')
- unset($vars['content']['links']);
- // dsm($vars);
- if($vars['type'] == 'didactique'){
- // dsm($node, 'node');
- if(!empty($node->field_emvideo))
- $vars['classes_array'][] = "emvideo";
- }
- // for HOME V2 : remove all table and other html, remains only the picture, from simplenews daily materio
- if ($vars['type'] == 'simplenews' && $vars['view_mode'] == 'teaser') {
- // get the body field
- $body = $vars['content']['body']['#items'][0]['value'];
- // get the frist image only
- preg_match('/<img[^src]+src="([^"]+)"[^>]+>/i', $body, $matches);
- // get the source path of the image
- $img_src = preg_replace('/^\/?sites\/default\/files\//', '', $matches[1]);
- // generate the uri of styled image
- $img_uri = image_style_url("card-full", $img_src);
- // generate the styled image file
- image_style_create_derivative("card-full", $img_src, $img_uri);
- // theme the new image tag
- $img = theme('image', array('path'=>$img_uri));
- // replace the body with this new styled image
- $vars['content']['body'][0]['#markup'] = $img;
- }
|