I have a Drupal 8 site for a client. I was in need of a way to allow them to easily link to managed files. I was recommended Linkint by a colleague who used the module all the time for Drupal 7 sites.

The description sounded fantastic. When I got it all set up and starting testing it, I realized when linking to files, the links were to the rather useless file entity page, not to the actual files themselves.

I've been doing research on this for two days, trying to find a solution. I found a thread for the Drupal 7 version of the module that was about this exact issue, and it had looked like this feature had been rolled into that version.

Am I missing something, some setting somewhere, either in Linkit, or in the file entity module? Is there anyway (even modifying module files, if I have to) to change the behavior to link to the actual file (such as a PDF or DOC file) rather than to the file entity page, which, out of the box in D8, doesn't even have a proper link to the file.

Thank you for any help you can offer,

Nathaniel

Comments

nkraft created an issue. See original summary.

nkraft’s picture

anon’s picture

Issue tags: -linkit, -files, -file entity

Sorry for late response.

Linkit 4.x and 5.x (both for D8) is linking directly to the files if you not using file_entity.

File entity alters the file path, so if they have some way to point directly to the file, we could do something like we did in Linkit 3.x.

anon’s picture

File entity module for drupal 8 is in beta. I tested it on 8.1.3 and it is has many major bugs.

Tho, when its ready, I think we should integrate with it, as I think many sites will use it.

gmclelland’s picture

Issue summary: View changes
StatusFileSize
new184.28 KB
new96.09 KB

For 7.x, I'm using Linkit 3.x with Media 2.x, File Entity 2.x, and https://www.drupal.org/project/ckeditor_link and https://www.drupal.org/project/ckeditor_link_file.

Note: just because the modules are labled ckeditor_... doesn't mean you have to use ckeditor. I'm using TinyMCE.

Those modules allows me to use Linkit to insert links to the file entity page which ckeditor_link_file then converts those links with an input filter to link directly to the files. ckeditor_link_file module also adds file usage so when I view the file entity usage, I can see which nodes link to that file. (Very helpful feature)

There is also a new module https://www.drupal.org/project/linkit_picker_file, but I haven't tested that to see exactly what it does.

I attached screenshots of the settings I use.

Hope that helps

audriusb’s picture

StatusFileSize
new649 bytes

We made a patch since we need this fucntionality now. Attaching it if someone else needs.

edit: make sure you have File matcher added to Linkit profile.

gmclelland’s picture

Status: Active » Needs review

Patch attached. Setting to NR

Status: Needs review » Needs work

The last submitted patch, 6: linkit_file_entity_link.patch, failed testing.

anon’s picture

The patch fails as its created in the wrong directory. Its created in the site root, should be linkit root.

Also, we can't force this behavior. it should be a setting in the file matcher.
A test for this is also needed.

ashopin’s picture

#5 worked for me but I had to patch manually since the function names don't match.

svenvdv’s picture

Any progress on this?

anon’s picture

Status: Needs work » Closed (outdated)

Any progress on this?

Yes, this works in 8.x-5.x now.

mlncn’s picture

Version: 8.x-4.1 » 6.1.x-dev
Status: Closed (outdated) » Active

If this works in Drupal 8 can we document how? Not able to get linkit to autocomplete Drupal core media module file paths at least.

megakeegman’s picture

You just have to configure the linkit profile, adding a matcher for media entities. EDIT: Oh and you have to first enable "Standalone media URL" in media settings config.

mark_fullmer’s picture

If this works in Drupal 8 can we document how? Not able to get linkit to autocomplete Drupal core media module file paths at least.

I understood this question somewhat differently than the answer provided in #14. Here's the documentation based on how I understand the question:

https://www.drupal.org/docs/extending-drupal/contributed-modules/contrib...

If this documentation should be updated or supplemented, please feel free to contribute!

mlncn’s picture

Status: Active » Fixed

So sorry for the noise— yes, Mark, that is exactly the documentation i needed! Thank you so much!

Status: Fixed » Closed (fixed)

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