function _extrafield_views_integration_get_extra_fields_for_entity_type in Extrafield Views Integration 7
Helper function to get all extra field for an entity type.
Parameters
string $entity_type: Name of the entity.
array $bundles: All bundles of the entity type.
array $extra_fields: Reference for the extra fields array.
1 call to _extrafield_views_integration_get_extra_fields_for_entity_type()
- _extrafield_views_integration_get_extra_fields in ./
extrafield_views_integration.module - Helper function to get all registered extra fields with an existing callback.
File
- ./
extrafield_views_integration.module, line 65 - Module file, implements needed hooks and helper functions.
Code
function _extrafield_views_integration_get_extra_fields_for_entity_type($entity_type, $bundles, &$extra_fields) {
foreach ($bundles as $bundle) {
$temp_fields = field_info_extra_fields($entity_type, $bundle, 'display');
if (!empty($temp_fields)) {
foreach ($temp_fields as $field_name => $temp_field) {
if (isset($temp_field['callback'])) {
if (isset($temp_field['file']) && file_exists($temp_field['file'])) {
require_once DRUPAL_ROOT . '/' . $temp_field['file'];
}
if (function_exists($temp_field['callback'])) {
$extra_fields[$field_name] = array(
'entity_type' => $entity_type,
'label' => $temp_field['label'],
'description' => $temp_field['description'],
'callback' => $temp_field['callback'],
);
if (isset($temp_field['file'])) {
$extra_fields[$field_name]['file'] = DRUPAL_ROOT . '/' . $temp_field['file'];
}
}
}
}
}
}
}