- πΊπΈUnited States robbt
I can confirm that this indeed is a problem with the current 5.5.alpha code.
I found that applying the patch to allow the customization of the number of columns here - https://www.drupal.org/project/views_bootstrap/issues/3120960 β fixed this problem.
I haven't delved deeper into why yet.
I realized that the approach I have taken utilizes row columns to make the grid responsive rather than changing the width of the individual columns and the overall container.
I'll try to compare the code with the patch and the default code and see if I can provide a simpler patch to fix this behavior but wanted to share my findings.
- @robbt opened merge request.
- Merge request !8fix issue #3324207 apply row classes to rows not columns β (Closed) created by robbt
- πΊπΈUnited States robbt
My first MR attempt where I cherry picked code from the other issue above is not working yet. I'll have to dive deeper into the code to determine what further changes are necessary. I'll update here when it's ready for testing.
- Status changed to Needs review
about 1 year ago 5:47pm 29 September 2023 - πΊπΈUnited States robbt
Ok so I figured out the issue is that in Views a row seems to be every column/item. Whereas in bootstrap a row is essentially a wrapper for a number of columns. So I just disabled the utilization of the built-in row class for the Bootstrap Grid and it appears to work and will allow you to utilize row-column classes to supercede the built-in columns.
The only reason I could think of not merging this is that it would remove the ability to apply classes to columns via the UI, but doing that would require overriding the built-in views code and language so that it says column vs. row because the terminology is confusing and contradictory.
Happy to have people review this.
- Assigned to shelane
- Status changed to Needs work
6 months ago 2:22am 16 May 2024 - πΊπΈUnited States shelane
This is close, but not quite the implementation that I do for other items. I will finish this up and get it merged. Thanks for your contribution.
- πΊπΈUnited States shelane
shelane β changed the visibility of the branch 3324207-grid-row-class to hidden.
- πΊπΈUnited States shelane
shelane β changed the visibility of the branch 3324207-grid-row-class to active.
-
shelane β
committed e2144b85 on 5.5.x
Issue #3324207 by shelane, Pallas Athena: Row class added to all columns
-
shelane β
committed e2144b85 on 5.5.x
- Issue was unassigned.
- Status changed to Fixed
6 months ago 3:51pm 16 May 2024 - πΊπΈUnited States robbt
I'm trying this code and it doesn't appear to work to provide the class to the row. I'll be testing when I applied to a test server I get an error - User error: "attributes" is an invalid render array key in Drupal\Core\Render\Element::children() (line 98 of core/lib/Drupal/Core/Render/Element.php).
And it looks like the row class code is applied to the columns and the new form is also applied to the column.
I see it added Custom column class which is added to every column as one would want and what was missing from my contribution but Grid row custom class also gets applied to the individual column divs and not to the entire row as was the intended behavior that my MR added.I'll tinker around with it further but thought I'd share my feedback thus far.
- Assigned to shelane
- Status changed to Active
6 months ago 2:24pm 22 May 2024 - πΊπΈUnited States shelane
You're right. Looks like the changes I made to the template were incorrect. Fix coming shortly...
-
shelane β
committed b6014a57 on 5.5.x
Issue #3324207 by shelane, demon326: Row class added to all columns
-
shelane β
committed b6014a57 on 5.5.x
- Issue was unassigned.
- Status changed to Fixed
6 months ago 2:43pm 22 May 2024 - Status changed to Needs work
6 months ago 6:27pm 22 May 2024 - πΊπΈUnited States robbt
Thanks for the quick response. I pulled the latest dev code and it was still providing me with the errors and not quite working as intended.
User error: "attributes" is an invalid render array key in Drupal\Core\Render\Element::children() (line 98 of core/lib/Drupal/Core/Render/Element.php).
And it isn't applying the row classes from Grid row custom class to the row div but instead it is now adding the row class to the top wrapper div that contains the view id vs. the next nested div (which is the row div).
Also now the columns aren't receiving the custom class from the Custom column class field under the bootstrap grid settings (which they were before this latest commit).
So I think additional work is needed. I'm not sure where the render array key errors is coming in but maybe attributes doesn't exist in the render key according to the error.
- πΊπΈUnited States robbt
I think I found part of the problem. A newer commit - https://git.drupalcode.org/project/views_bootstrap/-/commit/cf14a0ac12fc... - seems to have reverted the twig file templates/views-bootstrap-grid.html.twig that was modified in the previous MR - https://git.drupalcode.org/project/views_bootstrap/-/commit/e2144b8546f1...
So I'll see if I can come up with a working MR based upon the latest branch.
- Status changed to Fixed
6 months ago 7:06pm 29 May 2024 - πΊπΈUnited States shelane
The beta4 is working correctly according to labels of the fields. Please check your settings.
- πΊπΈUnited States robbt
Yeah sorry about the confusion. I discovered/remembered after a fair amount of troubleshooting that I had overwritten the twig template for the view in order to add some markup. So that was what was causing the issue on my part. Thanks and sorry for the confusion.
Automatically closed - issue fixed for 2 weeks with no activity.