I've done my research. Dug through the module code. I'm down to get my hands dirty, but I'm a bit lost.

Problem: In a Registration Setting View. When I go to add an entity relationship, I see "There are no relationships available to add."

This is not the case when doing it in reverse. A view of Registrations can easily access Registration Settings via a Relationship. However, I'm trying to make a view based on the settings not the actual registrations. Primarily to do a VBO action on multiple entities' settings at once.

I understand code, but I am not very clear on how the various levels works together. If I look at the Registration_Views module, it looks to me that the relation is only written one way. For example, the includes folder that hold the field handlers, does not have handles for all the values that are even in the settings.

But all that's fine, I just need a way to relate the host entity to the Registration Settings View, which does not seem possible.

Comments

Anonymous’s picture

I did it, I guess. Again, not 100% sure how all this works. But I added this code to registration_views_views_data() in registration_views.module

$data['registration_entity']['node'] = array(
    'title' => 'Host Node',
    'help' => 'Load Host Node',
    'relationship' => array(
       'title' => t('Host'),
       'base' => 'node', // base table
       'base field' => 'nid',
       'relationship field' => 'entity_id',
       'handler' => 'views_handler_relationship',
       'label' => t('Host Node'),
       'help' => t('Relate to Host Node'),
    ),
  );	

Not sure if this is the drupal way of doing things, but it seemed to work and it was a simple enough of a solution to add a relationship. So maybe it will help someone else.

Sam Moore’s picture

@ksjshark, you just saved me hours of messing around.

I'm using Registration with Commerce, so I need to create a relationship with the host product, which is a different entity type than a Node.
Fortunately this is pretty straightforward.

I've added the following (your code plus mine)


  /******************* enable parent node relationships in Views *************/
  $data['registration_entity']['node'] = array(
    'title' => 'Host Node',
    'help' => 'Load Host Node',
    'relationship' => array(
       'title' => t('Host'),
       'base' => 'node', // base table
       'base field' => 'nid',
       'relationship field' => 'entity_id',
       'handler' => 'views_handler_relationship',
       'label' => t('Host Node'),
       'help' => t('Relate to Host Node'),
    ),
  );
  /******************* enable parent Commerce product relationships in Views *************/

    $data['registration_entity']['commerce_product'] = array(
    'title' => 'Host Commerce Product',
    'help' => 'Load Host Product',
    'relationship' => array(
       'title' => t('Product'),
       'base' => 'commerce_product', // base table
       'base field' => 'product_id',
       'relationship field' => 'entity_id',
       'handler' => 'views_handler_relationship',
       'label' => t('Host Product'),
       'help' => t('Relate to Host Product'),
    ),
  );
  
  /**********************/

And the fun part is, it actually works.

One day when I have nothing to do I'll roll this into a patch...

ron_s’s picture

john.oltman’s picture

Status: Active » Closed (outdated)