function globallink_commerce_get_fields in GlobalLink Connect for Drupal 7.7
Gets commerce product fields based on bundle.
Parameters
string $bundle: The bundle.
Return value
array Array of fields.
2 calls to globallink_commerce_get_fields()
- globallink_commerce_get_xml in globallink_commerce/
globallink_commerce.inc - Gets XML data from specific commerce product.
- globallink_commerce_import in globallink_commerce/
globallink_commerce.inc
File
- globallink_commerce/
globallink_commerce.inc, line 174
Code
function globallink_commerce_get_fields($bundle) {
$fields = array();
$info = entity_get_info('commerce_product');
foreach ($info['bundles'] as $bundle_name => $bundle_info) {
if ($bundle_name == $bundle) {
foreach (field_info_instances('commerce_product', $bundle_name) as $field) {
$fields[] = $field['field_name'];
}
}
}
return $fields;
}