Commit 744f5a87 authored by webchick's avatar webchick
Browse files

#553306 by catch, bec, yched, zzolo, mradcliffe, webchick, plach: The rest of...

#553306 by catch, bec, yched, zzolo, mradcliffe, webchick, plach: The rest of remove redundant body and title node attributes & UI. The rest was accidentally committed in http://drupal.org/cvs?commit=363156. Sorry. :(
parent 10867760
<?php
// $Id$
/**
* @file
* Install, update and uninstall functions for the blog module.
*/
/**
* Implements hook_install().
*/
function blog_install() {
// Ensure the blog node type is available.
node_types_rebuild();
$types = node_type_get_types();
node_add_body_field($types['blog']);
}
......@@ -491,11 +491,20 @@ function node_update_7006(&$sandbox) {
if (!isset($sandbox['total'])) {
// Initial invocation.
// Re-save node types to create body field instances.
foreach ($node_types as $type => $info) {
if ($info->has_body) {
node_type_save($info);
// Get node type info, specifically the body field settings.
$result = db_select('node_type', 'node_type')
->fields('node_type')
->execute();
// Add body field instances for existing node types.
foreach ($result as $node_type) {
if ($node_type->has_body) {
node_add_body_field($node_type->type, $node_type->body_label);
}
$sandbox['node_types_info'][$node_type->type] = array(
'has_body' => $node_type->has_body,
);
}
// Initialize state for future calls.
......@@ -592,9 +601,12 @@ function node_update_7006(&$sandbox) {
db_drop_field('node_revision', 'teaser');
db_drop_field('node_revision', 'format');
// Remove node_type properties related to the former 'body'.
db_drop_field('node_type', 'has_body');
db_drop_field('node_type', 'body_label');
// We're done.
$sandbox['#finished'] = 1;
return t("!number node body and teaser properties migrated to the 'body' field.", array('!number' => $sandbox['total']));
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment