function _update_7000_node_get_types
Utility function: fetch the node types directly from the database.
This function is valid for a database schema version 7000.
Related topics
10 calls to _update_7000_node_get_types()
- comment_update_7000 in modules/
comment/ comment.install - Rename comment display setting variables.
- comment_update_7005 in modules/
comment/ comment.install - Create the comment_body field.
- comment_update_7006 in modules/
comment/ comment.install - Migrate data from the comment field to field storage.
- menu_update_7000 in modules/
menu/ menu.install - Migrate the "Default menu for content" setting to individual node types.
- menu_update_7001 in modules/
menu/ menu.install - Rename "Primary Links" and "Secondary Links" to their Drupal 7 equivalents.
File
-
modules/
node/ node.install, line 481
Code
function _update_7000_node_get_types() {
$node_types = db_query('SELECT * FROM {node_type}')->fetchAllAssoc('type', PDO::FETCH_OBJ);
// Create default settings for orphan nodes.
$all_types = db_query('SELECT DISTINCT type FROM {node}')->fetchCol();
$extra_types = array_diff($all_types, array_keys($node_types));
foreach ($extra_types as $type) {
$type_object = new stdClass();
$type_object->type = $type;
// In Drupal 6, whether you have a body field or not is a flag in the node
// type table. If it's enabled, nodes may or may not have an empty string
// for the bodies. As we can't detect what this setting should be in
// Drupal 7 without access to the Drupal 6 node type settings, we assume
// the default, which is to enable the body field.
$type_object->has_body = 1;
$type_object->body_label = 'Body';
$node_types[$type_object->type] = $type_object;
}
return $node_types;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.