function safeword_field_views_data in Safeword 7
Same name and namespace in other branches
- 8 safeword.module \safeword_field_views_data()
Implements hook_field_views_data().
File
- ./
safeword.module, line 541 - Provides a FieldAPI field type, widget, and several formatters for a combined human readable/machine name pair of values. Possible uses include automatic generation of editable pathauto segments, handy Views argument values, and impressing friends.
Code
function safeword_field_views_data($field) {
// Views has helper functions to build filters, sorts, args, and so on for
// FieldAPI data. All we need to do is ensure that the 'name field' for our
// argument definition is set properly, and we'll get the correct value in
// summary titles and breadcrumb trails.
// Alas, this only works if http://drupal.org/node/1016814 is applied;
// Hopefully that'll make it in.
$views_fields = field_views_field_default_views_data($field);
foreach ($views_fields as $key => $data) {
$views_fields[$key][$field['field_name'] . '_machine']['argument']['name field'] = $field['field_name'] . '_human';
}
return $views_fields;
}