6

I have made a module to alter the way entity reference works with autcomplete fields. I have override the entity_reference_autcomplete function where i have changed the following line:

        $key = "$label ($entity_id)";

with

        $key = "$label";

It seems to work when completing fields in form , but after the form has been submitted the autcomomplete field gets blank and the result is not saved . How can i solve this issue ?

  • You will also need to use a modified submit function. probably the default one tries to get $entity_id from the input using some regex or something – AyeshK Dec 17 '12 at 9:38
  • @AyeshK can you give more details ? – Vlasin Dec 17 '12 at 9:43
1

This should be done by writing a custom CTools EntityReference selection plugin. Your new class would just extend EntityReference_SelectionHandler_Generic_node and I think it would only need to override the getLabel() method to make things "just work".

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.