function multifield_get_subfields in Multifield 7.2
Same name and namespace in other branches
- 7 multifield.module \multifield_get_subfields()
Get all multifield subfields.
Return value
array A multi-dimensional array of subfields, first keyed by multifield machine name.
4 calls to multifield_get_subfields()
- MultifieldUnitTestCase::testDeprecatedField in tests/
MultifieldUnitTestCase.test - MultifieldUnitTestCase::testMultifieldField in tests/
MultifieldUnitTestCase.test - multifield_type_get_subfields in ./
multifield.module - Get all the fields created from a certain multifield type.
- multifield_type_has_subfields in ./
multifield.module - Check if a multifield has subfields.
1 string reference to 'multifield_get_subfields'
File
- ./
multifield.module, line 260
Code
function multifield_get_subfields() {
$subfields =& drupal_static(__FUNCTION__);
if (!isset($subfields)) {
if ($cached = cache_get('field_info:multifield:subfields', 'cache_field')) {
$subfields = $cached->data;
}
else {
$subfields = array();
$results = db_query("SELECT fci.bundle, fci.field_name FROM {field_config_instance} fci INNER JOIN {field_config} fc ON fc.id = fci.field_id WHERE fc.active = 1 AND fc.storage_active = 1 AND fc.deleted = 0 AND fci.deleted = 0 AND fci.entity_type = 'multifield'")
->fetchAll();
foreach ($results as $result) {
if (!isset($subfields[$result->bundle])) {
$subfields[$result->bundle] = array();
}
$subfields[$result->bundle][] = $result->field_name;
}
cache_set('field_info:multifield:subfields', $subfields, 'cache_field');
}
}
return $subfields;
}