I have written a module that allows for the creation of media entities from the Linkit CKeditor modal. If you have IMCE installed, you will notice a link on the top of the Linkit modal that says "Upload new file". My module does the same type of thing for Media entities.
The problem this solves is that, if you want to create a new media entity and then link to it from Linkit, you need to navigate away from the Linkit modal to create the media entity, then come back and reference it from Linkit. This module removes that extra step.
Code can be found on github (for now): https://github.com/zweishar/Linkit-Media-Creation
Here are some screenshots to help visualize what's going on:
Linkit modal open with creation link:

Media creation open after clicking link:

Submission back to linkit after media creation:

My question is, do you have any interest in integrating this into the main Linkit module? Perhaps as a submodule? If not I will upload this to D.O as a separate contrib module. If you are interested in integrating this functionality, I will re-write the module to fit within the main linkit namespace (or as a submodule).
| Comment | File | Size | Author |
|---|---|---|---|
| submit-back-to-linkit.png | 10.56 KB | zweishar | |
| modal-open.png | 47.33 KB | zweishar | |
| media-creation-link.png | 9.63 KB | zweishar |
Comments
Comment #2
ruslan piskarovHello @zweishar.
I like your idea. However, I think will be better to add as a separate module because not each website uses Media.
Comment #3
jonraedeke commentedThanks @zweishar,
I'd like evaluate your module for our use case, since it makes more sense than "embedding" a media entity that is just a link to a PDF document. Adding the project to d.o would be much appreciated.
Comment #4
zweishar commented@jonraedeke Thank you for your patience.
I have created a separate contrib project on D.O. to house this module: https://www.drupal.org/project/linkit_media_creation
For the record, linking to PDF documents was the exact use case that causes me to create this module.
Hopefully, you find it useful!
Comment #5
berdirThanks for this, would be great if you could do an actual release and not just an almost invisible dev. And add the screenshots/project description :)
Comment #6
oknateI have added a different approach. A button that opens the media library from the drupallink dialog:
https://www.drupal.org/project/linkit_media_library