Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow route overrides for direct linking through template filtering #50

Open
amazeika opened this issue Nov 20, 2017 · 2 comments
Open
Assignees
Labels
Milestone

Comments

@amazeika
Copy link
Member

amazeika commented Nov 20, 2017

The idea is to have a mechanism to override routes of direct file URLs served by files, e.g. thumbnails. This allows each app running files to override how this paths are constructed at render time.

An implementation example is rendering thumbnails link on FILEman on Joomla vs Platform. Platform requires the web part of the path to be stripped as it's part of the document root.

NOTE

This filter is to replace this utility method https://github.com/joomlatools/joomlatools-framework-files/blob/master/filter/path.php#L117-L128

Make sure to remove this code and places where this is being used after implementation.

@amazeika amazeika added this to the 3.2 milestone Nov 20, 2017
@johanjanssens
Copy link
Member

Proposed solution

Handle routing at render time by making use of the assets template filter. For inspiration check the code for the assets filter. It does the following:

'base://' => rtrim($this->getObject('request')->getBaseUrl()->getPath(), '/').'/'

See: https://github.com/joomlatools/joomlatools-framework/blob/master/code/libraries/joomlatools/component/koowa/template/filter/asset.php#L37

To create your own asset you can just use the core filter with the base:// scheme or another option could be to add an additional filter in com:files and introduce a file:// scheme, which would allow you to do additional processing.

You could do things like

file://container/path

Where file will be replaced by the url path, container by the container path and the path would be pre-pended. This would move the responsibility to create the url for the file to the filter, the cool thing about this is that it would make moving files into a CDN very simple, you just extend the filter to rewrite the paths differently.

@amazeika
Copy link
Member Author

For reference:

3371499

@amazeika amazeika self-assigned this Jun 22, 2018
@johanjanssens johanjanssens modified the milestones: 3.2, Backlog May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants