diff --git a/stormteam/stormteam.install b/stormteam/stormteam.install index 7fe3312..43c3978 100644 --- a/stormteam/stormteam.install +++ b/stormteam/stormteam.install @@ -10,6 +10,13 @@ */ function stormteam_install() { variable_set('node_options_stormteam', array('status')); + + // Uncache node types + node_types_rebuild(); + + // Fetch the list of current node types and add the body field to stormteam + $types = node_type_get_types(); + node_add_body_field($types['stormteam'],'Description'); } /** @@ -72,3 +79,15 @@ function stormteam_schema() { function stormteam_update_last_removed() { return 6201; } + +/** + * Adds Drupal 7 style body field to Storm Team nodes + */ +function stormteam_update_7100() { + // Uncache node types + node_types_rebuild(); + + //Fetch a list of current node types and add a body field to Storm Team + $types = node_type_get_types(); + node_add_body_field($types['stormteam'],'Description'); +} diff --git a/stormteam/stormteam.module b/stormteam/stormteam.module index ab3e402..3bf40f2 100644 --- a/stormteam/stormteam.module +++ b/stormteam/stormteam.module @@ -364,8 +364,9 @@ function stormteam_form(&$node) { $i++; } - if ($type->has_body) { - $form['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count); + $body = field_get_items('stormteam',$node,'body'); + if($body) { + $form['body_field'] = $body; } $form['title_old'] = array( diff --git a/stormteam/stormteam.theme.inc b/stormteam/stormteam.theme.inc index 42dc81d..8be185a 100644 --- a/stormteam/stormteam.theme.inc +++ b/stormteam/stormteam.theme.inc @@ -47,13 +47,18 @@ function theme_stormteam_view($variables) { ); } - $node->content['body_field'] = array( +$body = field_get_items('node', $node, 'body'); +if($body){ + $node->content['body'] = array( '#prefix' => '
', '#suffix' => '
', - '#markup' => theme('storm_view_item', array('label' => $type->body_label, 'value' => $node->content['body']['#value'])), - '#weight' => module_exists('content') ? content_extra_field_weight($node->type, 'body_field') : 0, + '#markup' => theme('storm_view_item', array( + 'label' => t('Description'), + 'value' => check_plain($node->body['und'][0]['value']) + )), + '#weight' => -15, ); - unset($node->content['body']); +} return $node; }