I needed the ability to link directly to files so I created a new plugin, Linkit File.

It does not use Pathologic filter as there is no support for a file: prefix.

Perhaps there is a way around this. Anyway, see attached patch.

CommentFileSizeAuthor
linkit_file.patch1.84 KBpeter törnstrand

Comments

anon’s picture

Nice, I will include this into Linkit as its a "drupal core functionality" with upload files.

I have also had some thoughts about the filter problem.
We already have this issue in linkit_views and linkit_panels_pages, and btw, I dont think linkit_views should even be in Linkit core anymore. Views is a optional module to install and not part of the D-core.

I have had some thoughts about making my own filter, pathfilter and pathologic isnt really usefull for anything thas not basically a node or term.

If we do our own filter, this most be very well thought-out, and support backward compatible with the two "older" filters.

Let me give you some example for a filter.

  • [linkit:view:12] and it will find the page url for the view ID 12.
  • [linkit:node:12] and it will find the node url for the node ID 12.
  • [linkit:term:12] and it will find the term url for the term ID 12.
  • [linkit:panelpage:12] and it will find the url for the panel page ID 12.

If anyone has some feedback or ideas on this, you are more the welcome!!

peter törnstrand’s picture

Is it not possible to approach the Pathologic team and perhaps supply a few patches to implement filter support for views, files, panels etc?

anon’s picture

Could be possible, I havent tried.

Pathologic has 4006 users
Path filter has 4003 user
So I think we should provide patches for both, or just favor one of them really good.

Pathologic seems more active tho, last relese 2010-Oct-29, and last commit 2 weeks ago.

peter törnstrand’s picture

I think you should focus on one module and my choice would be Pathologic.

anon’s picture

Status: Active » Fixed

Your patch is committed to 6.x-1.x-dev. This will be available in the 6.x-1.8 release
Thanks

Status: Fixed » Closed (fixed)

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

tseven’s picture

Title: Link to files » This plugin injects a hardcoded URL to the file including domain.
Version: 6.x-1.x-dev » 6.x-1.8
Status: Closed (fixed) » Active
'path' => file_create_url($file->filepath),

The function 'file_create_url' creates a full url. I'm not sure why this is needed. Simply removing this function allows the files relative path of "sites/default/files/filename.pdf" to be used.

This works better with multi-domain sites.

If both methods are desirable, can we add a setting to switch between the two?

Thanks

anon’s picture

Status: Active » Closed (works as designed)

I'm not sure why this is needed

file_create_url() checks if you have public or private filesystem for your site.

For D6
http://api.drupal.org/api/drupal/includes--file.inc/constant/FILE_DOWNLO...
http://api.drupal.org/api/drupal/includes--file.inc/constant/FILE_DOWNLO...

Same in D7, But it also "converts" the URI from the database to something usfull.
The URI from the DB is like "public://field/image/images-123.jpg".

anon’s picture

Title: This plugin injects a hardcoded URL to the file including domain. » Link to files
Version: 6.x-1.8 » 6.x-1.x-dev
Assigned: Unassigned » anon
Category: feature » task