function asin_field_views_data in Amazon Product Advertisement API 7.2
Same name and namespace in other branches
- 7 asin/asin.module \asin_field_views_data()
Implements hook_field_views_data().
Through this hook we're given the chance to change the views schema data for the asin field. The primary thing to be done is to add a join on the ASIN type to the amazon_item views base stuff.
File
- asin/
asin.module, line 403 - Defines a field type for referencing an Amazon product.
Code
function asin_field_views_data($field) {
$data = field_views_field_default_views_data($field);
foreach ($data as $table_name => $table_data) {
foreach ($table_data as $field_name => $field_data) {
// Check for fieldapi value fields.
if (isset($field_data['filter']['field_name'])) {
$data[$table_name][$field_name]['relationship'] = array(
'handler' => 'views_handler_relationship',
'base' => 'amazon_item',
'base_field' => 'asin',
'label' => t('ASIN from !field_name', array(
'!field_name' => $field['field_name'],
)),
);
}
}
}
return $data;
}