function hook_entityform_views_autofields_alter in Entityform 7.2
Allow altering fields automatically added to Entityform Views.
entityform_settings will already have been added to the current view display.
Parameters
array $autofields: Array of fields that will be added.
$view:
$display_id:
See also
_entityform_view_add_all_fields().
1 invocation of hook_entityform_views_autofields_alter()
- _entityform_view_add_all_fields in ./
entityform.module - Add automatically add all the fields for a Bundle to a View
File
- ./
entityform.api.php, line 132 - Hooks provided by the Entityform module.
Code
function hook_entityform_views_autofields_alter(array &$autofields, $view, $display_id) {
$view_entityform_settings = $view->display[$display_id]->entityform_settings;
$instances = field_info_instances('entityform', $view_entityform_settings['entityform_type']);
$view_mode = $view_entityform_settings['view_mode'];
foreach ($autofields as &$autofield) {
// Check to see this field was added by entityform.
if ($instances[$autofield['field_name']]) {
$field = $instances[$autofield['field_name']];
if ($label = _entityform_view_label_get_label($field, $view_mode)) {
$autofield['options']['label'] = $label;
}
}
}
}