Пример #1
0
/**
 *  allows participant-generated content to replace the parent content
 */
function connect_action_content_replace(&$parent, &$child, $op = '', $target = 'child')
{
    switch ($op) {
        case 'requires':
            $return = array();
            $return['parent'] = array('subject_replace_parent' => 'Content replace: the subject that can be rewritten.', 'body_replace_parent' => 'Content replace: the body that can be rewritten.');
            $return['child'] = array('subject_replace_child' => 'Content replace: the subject participant\'s version.', 'body_replace_child' => 'Content replace: the body participant\'s version.');
            return $return;
        case 'form_alter':
            $map = connect_get_map($parent->nid);
            $field = array('subject' => $map['subject_replace_child'], 'body' => $map['body_replace_child']);
            // filter text if required
            $cck_info = _content_type_info();
            $cck_vars = $cck_info['content types'][connect_node_options($parent->nid, 'participant_type')]['fields'];
            $text = array('subject' => connect_value('subject_replace_parent', $parent, $child, 'parent'), 'body' => connect_value('body_replace_parent', $parent, $child, 'parent'));
            if ($cck_vars[$field['subject']]['text_processing'] == 0) {
                $text['subject'] = strip_tags($text['subject']);
            }
            if ($cck_vars[$field['body']]['text_processing'] == 0) {
                $text['body'] = strip_tags($text['body']);
            }
            $child[$field['subject']][0]['#default_value']['value'] = $text['subject'];
            $child[$field['body']][0]['#default_value']['value'] = $text['body'];
            break;
        case 'insert':
            if ($target == 'child') {
                $addition = array('subject' => connect_value('subject_replace_child', $parent, $child, 'child'), 'body' => connect_value('body_replace_child', $parent, $child, 'child'));
                connect_value('subject_replace_parent', $parent, $child, 'parent', $addition['subject']);
                connect_value('body_replace_parent', $parent, $child, 'parent', $addition['body']);
            }
            break;
    }
}
       <?php 
     }
     ?>
     </div>
   <?php 
 }
 ?>
   <div class="content">
     <?php 
 if (isset($node->field_video) && $node->field_video[0]['embed'] && $node->field_video[0]['provider'] != 'livestream') {
     // teasers have inline display of all video except livestream
     ?>
       <div class="featured_image">
         <?php 
     $field_type = 'field_video';
     $system_types = _content_type_info();
     $field = $system_types['fields'][$field_type];
     // To set custom video size, uncomment these lines
     $field['widget']['video_width'] = 265;
     $field['widget']['video_height'] = 200;
     print theme('emvideo_video_video', $field, $node->field_video[0], 'emvideo_embed', $node);
     ?>
       </div>
     <?php 
 } elseif ($node->field_feature_image['0']['filepath']) {
     ?>
       <div class="featured_image">
         <?php 
     print theme('imagecache', 'gallery_thumb', $node->field_feature_image['0']['filepath'], $node->field_feature_image['0']['data']['description'], $node->field_feature_image['0']['data']['description']);
     ?>
       </div>