3

I am looking for a field just like Link, but that allows the user enter a URL or via an autocomplete a node/entity reference.

This is because this field might be an external link or an internal link in which case it should refer to the entity.

Any suggestions?

  • 1
    Use 2 fields for that, the data types for an entity reference field and a text field aren't the same. Id be surprised if you find a pre built module to do that, entity references aren't supposed to store urls – Clive Oct 7 '14 at 11:48
  • You could just set the 'autocomplete_path' on the textfield (form_alter) to point to a custom function that returned the drupal menu paths. Not a bad idea for a module. EDIT: answer added with modules I found with this functionality. – 2pha Oct 7 '14 at 12:34
2

Maybe one of these modules can help.
Advanced Link
Linkit

1

In Drupal 8 this works with normal link fields. You simply can choose if only internal, only external or both type of links can be entered in this field. You'll then get a autocomplete field that accepts either an entity title or an external link and a title.

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.