function easychart_node_type_insert in Easychart 7.2
Same name and namespace in other branches
- 7.3 easychart.module \easychart_node_type_insert()
- 7 easychart.module \easychart_node_type_insert()
Implements hook_node_type_insert().
File
- ./
easychart.module, line 26 - Easychart module file.
Code
function easychart_node_type_insert($content_type) {
if ($content_type->type == 'easychart') {
$body_instance = node_add_body_field($content_type, t('Chart description'));
// 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 (_easychart_installed_fields() as $field) {
field_create_field($field);
}
// Create all the instances for our fields.
foreach (_easychart_installed_instances() as $instance) {
$instance['entity_type'] = 'node';
$instance['bundle'] = 'easychart';
field_create_instance($instance);
}
}
}