0

In a content type, and a field is an entity reference to another content type (the professionals companies).

I created a view, to display: first: the professionals flagged as favorite; then all the others.

Then comes my problem:

How can I create a selection of professionals like this:

  1. If user click on the "empty" field (empty before selecting): the list of favorites appears (this can be the first 10 of my view)
  2. the user can type and like autocomplete, the results are shown.
  3. if no favorite found, then comes a text (with link) to add node (create a new professional).

enter image description here

In the widget type of the entity reference:

  • I tried "autocomplete" but the 1. doesn't work (user is obliged to type before something shows)
  • I tried "view" but it's even worse (and the search is difficult)
  • I tried "select list" but it doesn't allow to search.

I forgot to specify: The 3 options should be on the same field. So, when user click on the field to select (the company), the behavior of the field to select the garage should be like this:

  • User clicks on it: user's favorites companies appears (through view)
  • If the company he wants was not flagged as favorite, he can start to type in the field and the results appears (classic behavior in Drupal).
  • If the name of the company he types doesn't exist, the field shows "no result" and show a link to create a company.

1 Answer 1

0

maybe you should try these modules (at least for a part of your question):

Inline Entity Form can help you with #3 (embed a node form within another node form with option on existing nodes)

Entity Browser could help you with #1/#2 (build your own widget, based on a View, here with a contextual filter on logged in user and relationship to favorites) - really nice tutorial here.

and Flag for favorites.

I hope this could give you some fresh ideas.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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