?
avatar brianteeman
brianteeman
24 Oct 2016

Currently wherever we have a modal window in the front end (there are a lot of them) then the url used includes &tmpl=component

The problem is that this will always load the component.php of the default template NOT the component.php of the current template

From what I can see the url should be tmpl=component&templateStyle=(currentstyle)

I have no idea how to fix this code as in the php parts its within my skillset but for the JS i dont have a clue

Steps to reproduce the issue

Assign protostar as the default template
Assign beez as the template for a single article
Edit that single article and try any modal eg the ext-article plugin or any of the media buttons
View the source code of that modal and you will see that the template being used in the iframe is the protostar template and not the current template - beez

Expected result

The modal uses the currently defined template

Actual result

The modal always uses the default template

Additional comments

The same code (tmpl=component) is used in the admin as well but you can only ever have one active template in the admin so this wasnt noticed and so when the code was copy/pasted to the frontend views it was not noticed.

avatar brianteeman brianteeman - open - 24 Oct 2016
avatar brianteeman
brianteeman - comment - 24 Oct 2016

@dgt41 this further extends the issue you were trying to resolve in #11970
As you can see the issue is more widespread

avatar dgt41
dgt41 - comment - 24 Oct 2016

The problem (at least as I realize it) comes from the fact that modals don't have a menuid. The menuid is responsible for selecting the template so with this vital info missing joomla takes falls to whatever default is set on the renderer. There might be a way out with the registry, but this needs some serious debugging. @mbabker am I in the right track here, or this won't go anywhere?

avatar mbabker
mbabker - comment - 24 Oct 2016

Sounds valid. Tacking on either the Itemid or template query params would help it but it's still not the most efficient thing out there.

avatar dgt41
dgt41 - comment - 24 Oct 2016

Any other ideas?o

avatar Bakual
Bakual - comment - 24 Oct 2016

The Itemid imho is the right approach. There should be no URL without Itemid generated at all because it generates exactly such issues.

avatar mbabker
mbabker - comment - 24 Oct 2016

You can't generate these URLs with Itemid though because these URLs aren't tied to the menu system so at best you're going to get the default menu item unless each of these URLs explicitly specifies the current menu item's ID when it builds these routes.

avatar Bakual
Bakual - comment - 24 Oct 2016

Why can't you use the current Itemid when generating the modal link? In frontend, each page should have one that you can use and it is most likely the one you would expect for the modal.

avatar mbabker
mbabker - comment - 24 Oct 2016

You still have to go in and change every instance where the route is being generated to work that way. The main point though is you shouldn't have to explicitly state a menu item ID for this stuff (or a template), but without doing so you're getting beyond the capabilities of our routing systems.

avatar brianteeman
brianteeman - comment - 24 Oct 2016

Why can't you use the current Itemid when generating the modal link? In frontend, each page should have one that you can use and it is most likely the one you would expect for the modal.

.

You still have to go in and change every instance where the route is being generated to work that way.

As always i dont care how its done but it does need to be done.

avatar Bakual
Bakual - comment - 24 Oct 2016

You still have to go in and change every instance where the route is being generated to work that way.

Yep.

avatar mahagr
mahagr - comment - 25 Oct 2016

Using current Itemid has side effects as router may add new url variables that are defined for that specific menu item, thus potentially altering the behaviour of the requested page. This is issue if the menu item xml specifies extra url variables which allow you to change behaviour of the view, like limiting items by category.

avatar dgt41
dgt41 - comment - 25 Oct 2016

@mahagr the router in not used in these cases, all xtd-buttons are diverted to backend

avatar dgt41
dgt41 - comment - 25 Oct 2016

@mbabker @Bakual setting a cookie with the template and itemId, might be another approach?

avatar mahagr
mahagr - comment - 25 Oct 2016

I just wanted to bring up potential side effects; if there are none, I stay corrected.

I find setting cookie dangerous as you can have multiple windows/tabs open in your browser.

Personally I would love to go and use Itemid (when its safe) whenever possible as I'd really love to get rid of direct access to the components in some distant future.

avatar brianteeman
brianteeman - comment - 25 Oct 2016

Please remember that it is the templatestyle not the template

On 25 October 2016 at 09:30, Dimitri Grammatikogianni <
notifications@github.com> wrote:

@mbabker https://github.com/mbabker @Bakual https://github.com/Bakual
setting a cookie with the template and itemId, might be another approach?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#12537 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8Uy74bj2lDA57Yy-fR9tbgs6cdQxks5q3b4hgaJpZM4Ke-jJ
.

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
https://brian.teeman.net/ http://brian.teeman.net/

avatar brianteeman
brianteeman - comment - 25 Oct 2016

@dgt41 it is not just the xtd-buttons. Also all the links on edit forms
that open the media manager modals

On 25 October 2016 at 09:28, Dimitri Grammatikogianni <
notifications@github.com> wrote:

@mahagr https://github.com/mahagr the router in not used in these
cases, all xtd-buttons are diverted to backend


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#12537 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8fqDC9kWcDHkVR752wcEx046f0Siks5q3b2ugaJpZM4Ke-jJ
.

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
https://brian.teeman.net/ http://brian.teeman.net/

avatar brianteeman brianteeman - change - 28 Oct 2016
Status New Confirmed
avatar brianteeman
brianteeman - comment - 9 Dec 2016

So long and farewell

avatar brianteeman brianteeman - change - 9 Dec 2016
The description was changed
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2016-12-09 15:34:35
Closed_By brianteeman
avatar brianteeman brianteeman - close - 9 Dec 2016

Add a Comment

Login with GitHub to post a comment