I have been using the Entity Construction Kit (ECK) module to create custom entity types, bundles and entities away from the core node type. However managing entities through ECK is not as nice as the core node management. The Views Megarow module looks perfect for me to be able to create a custom admin interface.

The issue that I am having is that neither the stable nor dev versions of this module are able to handle the tokens for my custom entity type.

After some experimentation I found that this was not the case for every custom entity created through ECK. It turned out that if I named my custom entity type with more than one word, i.e. the machine name included underscores, then Views Megarow was unable to see the tokens for the custom entity type. Not only do they not appear in the placeholder tokens but manually entering a known token would not be rendered.

Unsatisfied with resorting to manually adjusting the machine names I went sniffing around the code and found the culprit on line 67 of the file views_handler_field_megarow_links.inc. I commented out the line and the tokens for my custom entity type worked. It appears that the getTokenType function is changing all token underscores to dashes, presumably to prevent the duplicate - and _ entries for fields. Other than that I am not entirely sure if there is any significance of the line.

I see that there are two potential options to fix the issue. The first would be to remove the line entirely but I am not sure what impact that would have. The second is to adjust the script such that it only replaces underscores after the first occurrence of a colon as to not interfere with the entity type. This being my first bug report having signed up earlier today I am not comfortable creating a patch to do so. I have also referenced an issue that may likely be related.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mexthecat’s picture

This worked for me.

mexthecat’s picture

Status: Active » Needs review
NWOM’s picture

Thanks! It worked for me using entities from the Redhen module.