Addon Location URL Problems

Hi All,

Just thinking, There must be some better way in ATK

Scenario: I have structure as follows

------------- lib and other for admin
------ lib and other for general site
------vendor (Composer)

I have other packages as well as my own ATK Addons in vendor.

I want to use Tinymce in both Admin and on Site using composer, so I have required it.
in by ATK Addon/initiator I have to include its location for js and css.

Lets say I have added this in Addon

So I get Addon Base Path for Site and Admin as follows

Admin : $addon_base_path = /Users/gowrav/Sites/xepan2/admin/…/vendor/tinymce/tinymce
Site: $addon_base_path = /Users/gowrav/Sites/xepan2/vendor/tinymce/tinymce

Which is all ok till now. Now, the problem begins with URL

If ATK Pathfinder can detect that “…” in path How I can set Proper setBaseURL for ‘vendor/tinemce/tinymce’ respectively.

Currently I am doing is


See “…” change !!!

Right now I have done if/else but must be some simple way.
Pathfinder is always been a problem in ATK FOR ME.

PathFinder will work differently depending on where your web-root is to map atk4/public folder. There are two scenarios:

  1. You have 2 sites, pointing inside your app/public folders directly. This makes “vendor” inaccessible. In this case we rely on either sym-links or copying assets (like we do with public/atk4 in installer) for those who are running Windows.

  2. If you have “admin/public” in your URL, then pathfinder will try add public folder’s path.

Code is here:

The “shared” folder is a bit trickier, because we are not sure what’s inside there, so ATK does not map public path there by default. If your application wants, you can use a similar approach to detect location and map your public assets.

I do think, however, that assets like that should have be properly copied inside the “public” folder of your admin/frontend respectively, but that would be a job of add-on installer inside sandbox, when it’s ready.

For now you can include manual instruction, in the readme of your add-on.