I didn't get a response to this one, but in case others run into this, I wanted to mention the answer.
Synopsis: Extended views support for relationships and the like has moved into Views, whereas it used to be in CCK. I got outstanding support from yched (fields) and dereine (views) on this. The issue was http://drupal.org/node/761372 I did update the Updating CCK Fields Modules from D6 to D7<http://drupal.org/node/728792>page with this info. Thanks, -Randy On Fri, Apr 2, 2010 at 11:19 PM, Randy Fay <[email protected]> wrote: > I'm porting Amazon module to D7. (All the code is in the dev version at > http://drupal.org/project/amazon). > > I can't get views relationships to work correctly, and don't know if it's a > views issue or fields issue (probably?) > > 1. The asin module in the Amazon project provides an ASIN field. This works > fine already. You can add asin elements to a node, it displays right, themes > right, everything. > > 2. Views is happy to do a node-type view and offers an ASIN as a field, and > displays it, themed correctly. > > 3. Amazon provides a full amazon_item data type to views, quite a rich set > of data about any amazon item, with prices, pictures, author, and all manner > of detail data all available as views fields. Views is very happy to present > all this data in an amazon_item-type view. > > 4. BUT: The relationship between a node with an ASIN field and the Amazon > item data is not there. No relationship is offered. So the most popular > feature of D6 Views with Amazon is out of reach: The ability to display an > incredible views list of nodes with lots of rich data about the Amazon items > in its fields. > > In D6, asin_field_settings() (hook_field_settings()) had the mapping, I > think, provided in a $op called 'views data'. But hook_field_settings() was > broken up into hook_field_schema() and hook_field_form_settings() and there > doesn't seem to be anything like this any more. > > Thanks for any help or ideas! > > -Randy > > Below is what the D6 asin_field_settings() had: > > function asin_field_settings($op, $field) { > switch ($op) { > case 'database columns': > $columns['asin'] = array('type' => 'varchar', 'length' => 32, 'not > null' => FALSE); > return $columns; > > case 'views data': > $data = content_views_field_views_data($field); > $db_info = content_database_info($field); > $table_alias = content_views_tablename($field); > > // Filter: Add a 'many to one' filter. > $copy = $data[$table_alias][$field['field_name'] .'_asin']; > $copy['title'] = t('@label (!name) - Allowed values', array('@label' > => $field['widget']['label'], '!name' => $field['field_name'])); > $copy['filter']['handler'] = 'views_handler_filter_many_to_one'; > unset($copy['field'], $copy['argument'], $copy['sort']); > $data[$table_alias][$field['field_name'] .'_value_many_to_one'] = > $copy; > // Argument : swap the handler to the 'many to one' operator. > $data[$table_alias][$field['field_name'] > .'_value']['argument']['handler'] = 'views_handler_argument_many_to_one'; > > // Add a relationship for related node. > $data[$table_alias][$field['field_name'] .'_asin']['relationship'] = > array( > 'base' => 'amazon_item', > 'field' => $db_info['columns']['asin']['column'], > 'handler' => 'views_handler_relationship', > ); > return $data; > } > } > > > -- > Randy Fay > Drupal Development, troubleshooting, and debugging > [email protected] > +1 970.462.7450 > > -- Randy Fay Drupal Development, troubleshooting, and debugging [email protected] +1 970.462.7450
