node_types_rebuild

5 node.module node_types_rebuild()
6 node.module node_types_rebuild()
7 node.module node_types_rebuild()
8 node.module node_types_rebuild()

Updates the database cache of node types.

All new module-defined node types are saved to the database via a call to node_type_save(), and obsolete ones are deleted via a call to node_type_delete(). See _node_types_build() for an explanation of the new and obsolete types.

8 calls to node_types_rebuild()

File

modules/node/node.module, line 464
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

function node_types_rebuild() {
  _node_types_build(TRUE);
}

Comments

example_node_install

function examplenode_install() {
//Updates the database cache of node types
node_types_rebuild();

$types = node_type_get_types();

// add the body field to the node type
node_add_body_field($types['job_post']);

// Load the instance definition for our content type's body
$body_instance = field_info_instance('node', 'body', 'job_post');

// Configure the body field
$body_instance['type'] = 'text_summary_or_trimmed';

// Save our changes to the body field instance.
field_update_instance($body_instance);

// Create all the fields we are adding to our content type.
foreach (_job_post_installed_fields() as $field) {
field_create_field($field);
}

// Create all the instances for our fields.
foreach (_job_post_installed_instances() as $instance) {
$instance['entity_type'] = 'node';
$instance['bundle'] = 'job_post';
field_create_instance($instance);
}
}

Login or register to post comments