Our site will have a database of games, each with a unique integer ID. There will then be reviews which reference these games. I have a table that stores the game information, and have this defined as an entity type with the game's id as the entity id. I have selected the game's name as the label under "Configure Entity Form." In the review content type, I have an entity reference field for the game, with the table entity as the target type, using simple mode. Now, regardless of whether I use a select list, checkboxes, or autocomplete, the label displayed is "- Restricted access - ". It does work, as when I select one, I will get the result I was expecting (using autocomplete) but it's not very useful to not be able to actually see the name of the game I'm selecting.

I feel like this should be a simple configuration change, but I haven't been able to locate it yet.

CommentFileSizeAuthor
#5 data-entity-access-fix-2277381-5-D7.patch711 byteschewie

Comments

gabtrek’s picture

Hi, I have the same problem here. Same example, same behavior.
Please, help!

Thanks.

kscheirer’s picture

As far as I can tell, it's because there's no access callback defined for the entities. There's a call to entity_access('view', $target_type, $entity) that always fails, so you get the default string "- Restricted access -".

The best solution would be to provide some sort of default access callback for all entities defined by data module. Or maybe you can add one with hook_entity_info_alter().

The workaround that I used was to set the entityreference field to use a view instead of simple entity selection. This would be the "Entity Selection" settings on the field. I created a simple view that returned the entity titles and use it on the field settings, seems to work fine.

joachim’s picture

Version: 7.x-1.0-alpha6 » 7.x-1.x-dev
Component: Miscellaneous » Code
Category: Support request » Bug report

> The best solution would be to provide some sort of default access callback for all entities defined by data module.

Agreed.

giorgosk’s picture

chewie’s picture

Status: Active » Needs review
StatusFileSize
new711 bytes

Hope this patch will help.
This is most simple solution for now.

jerry’s picture

Status: Needs review » Reviewed & tested by the community

Working fine here. Let's RTBC it.