Currently there are some error messages I can see when I use this module:
- Undefined index: entityreference in entityreference_calc_field_instance_settings_form() (line 118 of entityreference_calc.module)
- Notice: Undefined index: entityreference_type in entityreference_calc_field_instance_settings_form() (line 122 of entityreference_calc.module)

And there is a problem with the UI: I can choose any fields that isn't related to entityreference field. And this leads to this error message:
- EntityFieldQueryException: Unknown field: in EntityFieldQuery->addFieldCondition()

Sorry for my English!

Comments

tien.xuan.vo’s picture

Here is my patch. It has a lot of hacks that need to be reviewed.
I changed the UI, do some hacks on AJAX. The hook_update_n need more works.

frjo’s picture

Status: Needs review » Needs work

I glad you found the entityreference_calc module useful and want to help make it better!

I believe the "Undefined index" and "Notice" errors only shows up when there are no entityreference field pointing to the bundle yet. That should be fixed and some helpful message/information added.

I know the UI allows you to select any field, not just does that exist on the referencing node. I decided that this was not a big issue since it would be site builders and developers using it and they would know where they put there fields :-). It would be nice to get fixed however.

I would prefer a smaller patch that fixes these issues specifically and then i separate patch that does the refactoring on top of that.

Mr Richards’s picture

Comment moved here

frjo’s picture

@Mr Richards, your issue is not the same as tien.xuan.vo. Please delete the comment here and post it in a new issue instead of hijacking this one.

thehong’s picture

Issue summary: View changes

The patch is no longer applicable ):

tien.xuan.vo’s picture

StatusFileSize
new20.03 KB

Re-roll the patch. This patch contains improvement since the last patch.
Sorry because this patch is bigger than #1. If I have time I will split this patch into smaller patches, and then write unit test for this module.

nithinkolekar’s picture

EntityFieldQueryException: Unknown field: in EntityFieldQuery->addFieldCondition() (line 841 of /home/xxx/public_html/example.com/public/includes/entity.inc)

is still present with dev version (july 2017 build)

is that patch committed earlier?

Entity Api 7.x-1.8+1-dev