field_extract_bundle
- Versions
- 7
field_extract_bundle($obj_type, $bundle)
Helper function to extract the bundle name of from a bundle object.
Parameters
$obj_type The type of $object; e.g. 'node' or 'user'.
$bundle The bundle object (or string if bundles for this object type do not exist as standalone objects).
Return value
The bundle name.
Related topics
Code
modules/field/field.module, line 668
<?php
function field_extract_bundle($obj_type, $bundle) {
if (is_string($bundle)) {
return $bundle;
}
$info = entity_get_info($obj_type);
if (is_object($bundle) && isset($info['bundle keys']['bundle']) && isset($bundle->{$info['bundle keys']['bundle']})) {
return $bundle->{$info['bundle keys']['bundle']};
}
}
?>Login or register to post comments 