Linkit would be awesome as a widget for selecting entities using the entity reference module.

Is this kind of thing possible? (Is it something we could do?)

Comments

anon’s picture

This is actually a really nice idea, also a widget for the regular link field.

grossmann’s picture

+1
I got the same idea just now. I looked up the issue queue and *pop* someone had the same idea just days ago. I think this would be a nice field-widget for all kind of autocomplete fields like node ref, term ref, file ref, ... and of course entity ref (which should replace all the others).
grossmann-mcs

anon’s picture

I think we only should give support for entity ref. as the other are deprecated or will be.
There is also another request about support the link (url) field from the link module.

When it comes to the implementation, I have a branch for this (field-widget).

Im thinking that we should be able to just tell the field widget to use linkit for the field instread of the original handler.
In this way, entityref, link, and also normal text fields can use linkit.

The code in the branch is just me experimenting on how we could do this.

grossmann’s picture

You are right with entity ref to be the most important. But what for the sites which implemented node ref or term ref before entity ref was around. I don't know if there is a way to transform an node ref to an entity ref without loosing the old references but I would really like to see this for the others too but priorities are clear on entity ref (and of cause the link module).
grossmann-mcs

anon’s picture

Yes, the primary goal is to support entity ref, and link, but sure, it would be nice to have support for the older ref modules as well.

anon’s picture

Title: Entity Reference Widget » Support for field widgets (Text, Link, Entity ref)

Now there is a bacis support for text_textfield and link_field in the bransh called field-widget.

The entity reference is a bit more tricky to get working as the output has to be
"Lorem ipsum (entity_id)"

So the process building the actually link will have to change upon this.
Not sure how to handle this in the best way right now.

Any feedback?

anon’s picture

Version: 7.x-2.1 » 7.x-2.x-dev
Status: Active » Fixed

Now we have support for text fields, textareas and link fields (from the link module).

I also added something I will call "insert plugins".
That is small plugins that will control how the links is inserted in the source field.
Please note that this isn't for editors, just fields.

Insert plugins available are:

  • HMTL Link <a href="/node/1" title="my title" ...>My text.
  • Raw URL /node/1
  • Markdown [An example](/node/1 "Title")

Note:
Selections (text you have selection in the field) is only supported by textareas.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

leanderl’s picture

Any progress on this?. It seems like a great way to improve entity reference fields. I'd be happy to try to contribute but I can't find the "field-widget" branch mentioned in #3

leanderl’s picture

StatusFileSize
new2.2 KB

So this is what I did temporarily with the References (node_reference) module. It's extremely rough, but allows me to let the "editor user" pick nodes through linkit. Now If I could only get Linkit_picker up to date with linkit 7-2 i would have a nice usability going...

leanderl’s picture

Status: Closed (fixed) » Needs work
Elvar’s picture

StatusFileSize
new892 bytes

We used the support for fields on our project, but we still lacked the title when selecting a link.
For that very reason i created this patch against 2.5, maybe some other finds it useful. :-)

danquah’s picture

Status: Needs work » Needs review
StatusFileSize
new936 bytes

The patch in #12 breaks some modal windows on submit if the title is not present. Attached patch introduces a check of whether the title-field exists before attempting to set it.

korven’s picture

Subscribing!

anon’s picture

Status: Needs review » Fixed

Title support fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

fehin’s picture

Status: Closed (fixed) » Active

I'm using "markdown" widget with a text field and the inserted links don't convert the tokens to links on display page. It looks like this [An example](/node/1 "Title").

How do I fix this?

anon’s picture

Status: Active » Closed (fixed)

That is not the scope for Linkit. Linkit just provied the data, not the convertion at the presentation.

fehin’s picture

Status: Closed (fixed) » Active

This doesn't make sense. Entity reference also provides links to referenced node in a similar way but the displayed nodes can be formatted as links out of the box. This module spits out tokens when it claims it's a linking module. If it doesn't format the output, then how is it a link? Also if it doesn't format the output, shouldn't info be provided on how to turn the output into a link? My field is a regular text field and I'm not sure of what to do to theme the output.

anon’s picture

Status: Active » Closed (won't fix)

Why do you markdown as input filter for a field if you dont parse the output?

Use the HTML Link inpout filter andyou will get the link.

anon’s picture

Status: Closed (won't fix) » Closed (works as designed)