diff --git a/stormproject/stormproject.install b/stormproject/stormproject.install index 695becc..00e04a5 100644 --- a/stormproject/stormproject.install +++ b/stormproject/stormproject.install @@ -5,6 +5,13 @@ */ function stormproject_install() { variable_set('node_options_stormproject', array('status')); + + // Uncache node types + node_types_rebuild(); + + // Fetch list of current node types and add body field to stormproject + $types = node_type_get_types(); + node_add_body_field($types['stormproject'],'Description'); $attributes = array(); @@ -125,3 +132,17 @@ function stormproject_schema() { function stormproject_update_last_removed() { return 6202; } + +/** + * Adds Drupal 7 style body field to storm project node + */ +function stormproject_update_7100() { + // Uncache node types + node_types_rebuild(); + // Fetch list of current node types and add body field to storm project + $types = node_type_get_types(); + node_add_body_field($types['stormproject'],'Description'); + + return 'Added D7 style body field to storm project nodes'; +} + diff --git a/stormproject/stormproject.module b/stormproject/stormproject.module index 5f245d6..ffe2f46 100644 --- a/stormproject/stormproject.module +++ b/stormproject/stormproject.module @@ -631,8 +631,10 @@ function stormproject_form(&$node) { '#weight' => 2, ); - if ($type->has_body) { - $form['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count); + //Check to see if the body field is still there, if so, display it. + $body = field_get_items('stormproject',$node,'body'); + if($body) { + $form['body_field'] = $body; } $form['title_old'] = array( diff --git a/stormproject/stormproject.theme.inc b/stormproject/stormproject.theme.inc index a11cdd3..c1f175e 100644 --- a/stormproject/stormproject.theme.inc +++ b/stormproject/stormproject.theme.inc @@ -118,14 +118,16 @@ function theme_stormproject_view($variables) { '#markup' => theme('storm_view_item', array('label' => t('Assigned to'), 'value' => l($node->assigned_title, 'node/'. $node->assigned_nid))), '#weight' => 2, ); - - $node->content['body_field'] = array( - '#prefix' => '
', - '#suffix' => '
', - '#markup' => theme('storm_view_item', array('label' => t('Description'), 'value' => $node->content['body']['#value'])), - '#weight' => module_exists('content') ? content_extra_field_weight($node->type, 'body_field') : -18, - ); - unset($node->content['body']); + + $body = field_get_items('node',$node,'body'); + if($body){ + $node->content['body'] = array ( + '#prefix' => '
', + '#suffix' => '
', + '#markup' => theme('storm_view_item', array('label' => t('Description'), 'value' => check_plain($node->body['und'][0]['value']))), + '#weight' => 4, + ); + } return $node; }