Closed (fixed)
Project:
Corresponding Entity References
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Aug 2012 at 22:01 UTC
Updated:
1 Jul 2013 at 13:11 UTC
Hi, I have installed last dev version, all seems ok, but when I switch "Entity selection mode" from Simple to view (and viceversa) I receive this error in my error_log:
PHP Fatal error: Class EntityReference_SelectionHandler_Views contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EntityReference_SelectionHandler::validateAutocompleteInput) in /home/webmaster/htdocs/mysite/sites/all/modules/entityreference/plugins/selection/EntityReference_SelectionHandler_Views.class.php on line 150, referer: http://XXXX.XXX/admin/structure/types/manage/macchina-asta/fields/field_...
Thanks.
M.
Comments
Comment #1
chertzogYeah, Using a view to select the reference-able entities doesnt work (at the moment). This is because if you use a view to select the entities, you could allow multiple types of entities and because this module requires that you set up a 1 to 1 relationship between two fields, there is no way to guarantee that with a view.
This is something that i would like to get working, but at the moment I have no idea how to handle.
Unlike CNR where it only works with node, you can find out the bundle of the node with just the ID, with entities you can have multiple entities with the same ID number, they just have different entity types/bundles.
Patches are welcome....
Comment #2
phenaproximaI'm writing a quick patch for this, as mentioned in http://drupal.org/node/1923566.
For now, said patch will simply treat Views-based entity reference fields as black boxes, and not filter by entity type or bundle. But perhaps that could be made more robust later by checking the base table of the view, or something like that. Another approach could be to override Entity Reference's display plugin and replace it with a version that provides additional methods for getting the available entity type(s) and bundle(s), which could in turn be called by CER.
Comment #3
phenaproximaPatch submitted: http://drupal.org/node/1923566#comment-7203526
Comment #4
phenaproximaRegarding this issue, and a more robust solution - here is a bit of non-functional proof-of-concept code I wrote to illustrate my idea in #2, and hopefully present a possible solution to the problem, if only in a very basic way:
Comment #5
phenaproximaNew patch submitted (and this one isn't a quick let's-hope-this-works hack job): http://drupal.org/node/1923566#comment-7235840
Comment #6
phenaproximaFixed in the 2.x branch (git only, at the time of this writing).
Comment #7
chertzog7.x-1.x is deprecated.