Saturday, 22 October 2022
  5 Replies
  2.5K Visits
0
Votes
Undo
  Subscribe
We still have issue to manage the display a column or not based on the presence of module like we do in a classic template file (if module exist on the position then 2 columns else only one column) we could have other scenarios based on custom fields etc
You mean in the layout? So you set up a 3 column layout and you want this to fall back to a 2 columns layout if there is no content in one of the columns? The one complication I see with this is if your column widths are something like 1/2 1/3 1/6 and the 1/3 column is dropped how to you allocate the space released between the other columns?

For your custom field conditions you want to be able to add display conditions to the column and not just to individual field?

Review EasyLayouts. If you use EasyLayouts please post a rating and a review at the Joomla! Extensions Directory.
https://extensions.joomla.org/extension/easylayouts/

In the the layout yes !
In a 'classic' manual override we define the div class (spanx or col-x depends of the framework) based on the presence of a module or not, or if a custom field is empty or not. And you finally get 8/12 + 4/12 if a module/customfield and 12/12 for example without.
I realize how complex it could be to implement this. One way could be :

  • In the row options where we actually set the x/12 etc you add a subform
  • For each line of the subform we have to add conditions (maybe codified in your way) in a input and a layout : moduleposition["xxxxx"] is empty the 12/12 or customfieldid[5] is not empty then row layout is 8/12 4/12
  • the first and actual input is the default layout the other are tested top to the bottom and the last one which is ok is the one which is rendered
We currently force you to set col widths as fractions of 12 in the row declarations.

But we could use https://getbootstrap.com/docs/5.0/layout/grid/#setting-one-column-width instead in addition so in your case you would enter something like the following (not coded yet!)


col 4/12


when EasyLayouts saw 'col' it would use the one column width value instead of col-8 so that if the 4/12 column was empty it will expand to fill the space.

For your custom field conditions an alternative approach (which would be a lot easier to code) would be to allow the condition on a row basis and you would duplicate the rows for each alternative outcome. To make this easy to use I would been to implement a 'duplicate row' method in the layout editor so you could create one row layout and then copy it and modify the copy.

what do you think?

Review EasyLayouts. If you use EasyLayouts please post a rating and a review at the Joomla! Extensions Directory.
https://extensions.joomla.org/extension/easylayouts/

1/ If I talk about span col- etc it was just for talking about how we do in am,ual override, don't change your code ^^ Keep the fraction!
2/ The "alternate rows" is interesting and if it's easier to code... The real question is : how do you implement the condition ? What codition do we need etc You have to code your "condition syntax", maybe you culd look at how regular Lab code these because his extensions use a lot of these conditions and a lot of ppl already use them so it benefit to every one to re-use the same language.
1. What I was wondering was simply to offer an alternative of "col". So you would have the choice of using fractions that add up to 1 e.g.

1/3 1/3 1/3

or

1/3 col 1/3

the second approach would mean that bootstrap take care of the empty column for us with no need for fancy coding

I suppose an alternative would be to use something like

1/3 1/3 1/3|1/2 1/2

So if there are 3 columns class names would be "col-4 col-4 col-4" but if there was one empty (and skipped) it would use "col-6 col-6"

That would be "fairly striaghtforward" to implement.

2. For the row based conditionality I was thinking about your custom field criteria - I would implement it like we implement the specific field output currently.

Review EasyLayouts. If you use EasyLayouts please post a rating and a review at the Joomla! Extensions Directory.
https://extensions.joomla.org/extension/easylayouts/

  • Page :
  • 1
There are no replies made for this post yet.

If you use EasyLayouts please post a rating and a review at the
Joomla! Extensions Directory.