Created
April 14, 2011 00:44
-
-
Save rfay/918723 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function asin_field_views_data($field) { | |
$data = field_views_field_default_views_data($field); | |
// Skip items that are already in the views data. | |
$field_skips = array_keys($data); | |
array_unshift($field_skips, 'table', 'entity_id', 'revision_id'); | |
foreach ($data as $table_name => $table_data) { | |
foreach ($table_data as $field_name => $field_data) { | |
if (!in_array($field_name, $field_skips)) { | |
$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'])), | |
); | |
debug($data[$table_name][$field_name]['relationship'], "\$data[$table_name][$field_name]['relationship']"); | |
} | |
} | |
} | |
return $data; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment