function _faq_add_custom_fields in Frequently Asked Questions 7
Code examples modified.
See also
http://www.sitepoint.com/creating-a-new-drupal-node-type/
http://www.thecarneyeffect.co.uk/creating-custom-content-type-adding-fie...
2 calls to _faq_add_custom_fields()
- faq_install in ./
faq.install - Implements hook_install().
- faq_update_7002 in ./
faq.install - Convert old-style detailed questions to new fields.
File
- ./
faq.install, line 432 - FAQ module install file.
Code
function _faq_add_custom_fields() {
foreach (_faq_installed_fields() as $field) {
field_create_field($field);
}
foreach (_faq_installed_instances() as $fieldinstance) {
$fieldinstance['entity_type'] = 'node';
$fieldinstance['bundle'] = 'faq';
field_create_instance($fieldinstance);
}
}