function commerce_invoice_ensure_fields in Commerce Invoice 7.2
Ensure required fields are present on invoices.
1 call to commerce_invoice_ensure_fields()
- commerce_invoice_install in ./
commerce_invoice.install - Implements hook_install().
File
- ./
commerce_invoice.module, line 433 - The Commerce Invoice module.
Code
function commerce_invoice_ensure_fields() {
module_load_include('inc', 'commerce_invoice', 'commerce_invoice.fields');
foreach (commerce_invoice_required_field_bases() as $field) {
if (!field_info_field($field['field_name'])) {
field_create_field($field);
}
}
foreach (commerce_invoice_required_field_instances() as $instance) {
if (!field_info_instance($instance['entity_type'], $instance['field_name'], $instance['bundle'])) {
field_create_instance($instance);
}
}
}