? Failure

User tests: Successful: Unsuccessful:

avatar okonomiyaki3000
okonomiyaki3000
6 Nov 2019

Pull Request for Issue # .

Summary of Changes

Both ComponentLayout and ModuleLayout field types check their form for a template_style_id setting and then, if it is found, limit their options to layouts within the selected template.

Since there are perfectly legit reasons why you might want to use a style from one template and a layout from another, I have removed this unnecessary limitation.

Testing Instructions

  1. Have multiple templates installed. Each with various layout overrides.
  2. Create a category menu item. Can default or blog type doesn't matter. The point is to get a form with a ComponentLayout field in it.
  3. Select a specific Template Style (not default) and save.
  4. Go to the Options tab where you can choose a layout for article pages.

Expected result

You would want the Choose a Layout field to give you all the options.

Actual result

Prior to this change, you would get all options only if your Template Style is set to default. Any other setting will limit options to layouts from the component or the selected template.

Documentation Changes Required

Probably not.

avatar okonomiyaki3000 okonomiyaki3000 - open - 6 Nov 2019
avatar okonomiyaki3000 okonomiyaki3000 - change - 6 Nov 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 6 Nov 2019
Category Libraries
avatar okonomiyaki3000
okonomiyaki3000 - comment - 6 Nov 2019

Looks like Drone failed but, I assure you, this is a Drone problem and not a problem with this PR.

avatar brianteeman
brianteeman - comment - 6 Nov 2019

This seems very wrong to me and not possible to make work 100%

Scenario
Template 1 uses bootstrap 4
Template 2 uses foundation

Using a layout designed for foundation in a template designed for bootstrap is likely to cause problems eg wrong css, wrong js etc being loaded

avatar okonomiyaki3000
okonomiyaki3000 - comment - 6 Nov 2019

@brianteeman You're right. That would be a mistake. So don't do it. Just like you don't do it now even though you are able to as long as Template Style is set to default. Or when you're creating any type of menu item that might have layout overrides in a different template. Or when you specify the layout a particular article should use.

As a user, you know which templates you have installed and how to use them. You're allowed to do something weird because you're not prevented from doing something useful. <-That is not a proposal, that is the situation now in most cases.

The only thing this PR does is remove an arbitrary limitation that exists in a specific situation which then gives you the same freedom that you already have in other areas.

avatar mbabker
mbabker - comment - 6 Nov 2019

I'm missing something obvious here. You're setting the template style to a specific thing, which to me should mean that the only options the user are shown are related to the selected template style. So with your specific example of the category menu item, I'm not following why you should be allowed to set the menu item to use template style Bootstrap 4 yet choose a layout from the Materialize template. That just feels counter-intuitive to me personally.

avatar okonomiyaki3000
okonomiyaki3000 - comment - 7 Nov 2019

@mbabker First of all, template style is always set to something specific. It might usually be the default but that's still a specific style and yet you can choose a layout from any template or the component when it is set to default. When it's set to something else, you can still still select layouts from the component which may not be very compatible with your selected template style. It's not Joomla's job to decide which layouts work well with which template styles. That's your job as a user.

Selecting layouts from other templates is already a feature a Joomla. When you select Menu Item Type, you are selecting a layout and it is 100% legal to select one from a different template. There is plenty of code already in Joomla specifically written to make this happen. When you select a layout from another template, your Link field will contain something like layout=<template>:<layout>. This special colon-separated expression exists exactly for this reason. This PR does nothing new. It only removes a limitation that is arbitrary and meaningless.

Anyway, you're thinking of it the wrong way. It's not about mixing Bootstrap4 with Materialize or anything else. I believe it's counter-productive to require a use-case for things which give the user more freedom at zero cost but if it helps you, how about this: You have a site with templates A, B, and C and each template has a number of styles defined (A1, A2, B1, etc). Just to simplify things, let's say they're all based on Bootstrap4. Although they are different templates with mostly unique layouts, there is a common article layout that they all need to use. This article layout is defined inside of template A. As it is, B and C can already use it in several ways. They can use it as a single article type menu item. They can use it for articles that appear under category type menu items but only if they specifically set it for each individual article. The thing they can't do is to set the category to use this layout for all of its article pages. For some reason, they're prevented from doing this one thing. It's not even a limitation of Joomla, it's an arbitrary limitation of the select field in the form. Joomla is already perfectly cable of doing what the user wants if only the field didn't get in the way. So the only solution available is to duplicate that same layout in templates B and C. Now it has to be maintained in three places instead of one. Let's stop that. It's nonsense.

avatar mbabker
mbabker - comment - 8 Nov 2019

I'm honestly not following either the issue or the fix, or really why the limitation is there in the first place. Maybe I'm over thinking things but I would expect if you explicitly set a template style then layout based options in that area (and anything inheriting from it) would be restricted to those compatible with that template style (because that act of explicit declaration is overriding an implicit setting inherited from somewhere else, same way as an explicit ACL config overrides an implicit config inherited from higher); to me it's not about a perceived lack of flexibility but rather filtering the system to match an expectation, and I think whomever coded the current behavior had the same expectation that I do.

Either way the one sure thing I get from this pull request is that Joomla's parameter system is way over-engineered and the day people stop talking about cleaning up the 2479805 different options or levels of option inheritance/overriding and actually do something about it would be a good day.

avatar okonomiyaki3000
okonomiyaki3000 - comment - 11 Nov 2019

@mbabker I just typed out a long response for you but then I lost it and I don't really want to type it all again so the bottom line is this:

Joomla is making a bad assumption about what the user wants for the purpose of making a (rarely used) select field only very slightly simpler but the cost is that it is adding an artificial limitation that makes it impossible to do more interesting things. If you're using that field at all, you're much more likely to be doing more interesting things. This is not an addition of a new feature, this is the removal a meaningless limitation.

avatar okonomiyaki3000
okonomiyaki3000 - comment - 19 Nov 2019

Come on, guys, let's take off these training wheels.

avatar okonomiyaki3000
okonomiyaki3000 - comment - 7 Jan 2020

Hey guys, have you come to see reason on this issue yet? For real, I'm right about this one.

avatar HLeithner
HLeithner - comment - 7 Jan 2020

This will not go into J3, I see a reason for this and would accept it in J4 but that's @wilsonge decision.

avatar SharkyKZ
SharkyKZ - comment - 3 May 2020

This fixes a bug described in #17912.

avatar zero-24
zero-24 - comment - 12 Jun 2022

This will not go into J3, I see a reason for this and would accept it in J4 but that's @wilsonge decision.

as mentiond by @HLeithner this will be closed here.

avatar zero-24 zero-24 - change - 12 Jun 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-06-12 17:27:44
Closed_By zero-24
Labels Added: ?
Removed: ?
avatar zero-24 zero-24 - close - 12 Jun 2022

Add a Comment

Login with GitHub to post a comment