1

I have a custom entity (emtr) with a property called unit_tid (that relates to a taxonomy term).

When I create a view of my custom entity I want access to the fields associated with the related taxonomy term.

This question, Using Drupal7 custom entities in views, is on the same topic, and started me off on the right path.

So my hook_views_data_alter looks like:

function my_module_views_data_alter(&$data) {

    $data['emtr']['unit_tid']['relationship'] = array(
        'base' => 'taxonomy_term_data', // the name of the table I'm linking to
        'base field' => 'tid', // the field I'm linking to in taxonomy_term_data
        'relationship field' => 'unit_tid', // the name of the field in the emtr table
        'handler' => 'views_handler_relationship',
        'label' => t('Unit'),
    );
    //dpm($data);

}

However when I edit my view in the field list it says: Broken/missing handler (Unit_tid) and if I click on it the popup says:

The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.

What am I doing wrong in creating the relationship?

(Other related questions / resources include: How to add relationship in view for custom entity, Enable Relationships in Views with Entities?, Integrating entities with Views)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.