Sometimes for proper styling we need to add a class on the rows parent div. This div already has the "row" class but that is too generic, and overriding views-bootstrap-grid.html.twig template is my only option. So, let's provide a new Views settings for the Grid style.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

gnikolovski created an issue. See original summary.

gnikolovski’s picture

StatusFileSize
new2.08 KB
gnikolovski’s picture

Status: Active » Needs review
Anatoliy Vorobyov’s picture

Patch adding new class to row, but not to parent of rows.
So @gnikolovski please adjust description or add class to parent of rows - in this case to ".views-view-grid".

gnikolovski’s picture

Version: 8.x-3.x-dev » 8.x-4.x-dev
aburrows’s picture

Add a condition if the class is empty. It might be better using the twig attributes.addClass.

pixiekat’s picture

StatusFileSize
new2.13 KB

Came across this issue since I was having trouble with it too and had some problems running the patch against the latest 4.x branch so I updated it.

Status: Needs review » Needs work

The last submitted patch, 7: 0001-updating-parent-class-3024039.patch, failed testing. View results

dehacker’s picture

Hope to see this functionality added to the module.

tim corkerton’s picture

Great, I love it. Does just what I need

shelane’s picture

Version: 8.x-4.x-dev » 5.4.x-dev
tguerineau’s picture

I've successfully tested the 0001-updating-parent-class-3024039.patch patch on my local environment with Drupal 10 and I can confirm it works as expected. Here's a brief rundown of what I did:

- I ran PHP_CodeSniffer using the Drupal standard on the updated ViewsBootstrapGrid.php file to ensure it conforms to Drupal's coding standards. The file passed without any errors.

- I tested the functionality in a Drupal 10 environment to ensure that the 'rows_parent_class_custom' field appears in the views UI, and that its value is added as a class to the parent of rows. Everything functioned correctly.

- Additionally, I inspected the changes in the .twig file and manually checked that it followed Twig's standards.

tguerineau’s picture

Status: Needs work » Reviewed & tested by the community

milos.kroulik made their first commit to this issue’s fork.

anybody’s picture

@aburrows any change to get this merged soon? Would be really helpful.
If you need Co-maintainer help, feel free to ping we, so our team is willing to support.

Thank you!

thomas.frobieter’s picture

@anybody it's already included in the current 5.x beta

anybody’s picture

I can't see any commit message or merge here. Should it be closed fixed then @aburrows?

shelane’s picture

The 5.4 branch and 5.5 branch are separate branches supporting different versions of Bootstrap. Even if this is fixed for 5.5 doesn't mean it's fixed for 5.4. @aburrows has been supporting the 5.4 branch, but if he's not available, I can take a look in a couple of weeks.

anybody’s picture

Thanks for the clarification @shelane, I wasn't aware of that.

shelane changed the visibility of the branch 3024039-carousel-item-wrapper to hidden.

  • shelane committed b8c9f3d6 on 5.4.x
    Issue #3024039 by shelane, gnikolovski, pixiekat, tguerineau: Provide...

  • shelane committed ee296463 on 8.x-4.x
    Issue #3024039 by shelane, gnikolovski, pixiekat, tguerineau: Provide...
shelane’s picture

Status: Reviewed & tested by the community » Fixed

This is not the same implementation that exists for the Bootstrap 5 version. I really don't want to add a third custom class option. The change made for this version is the parent of the row. For the Bootstrap 5 version, the custom class is applied directly to the row class. There are many means of achieving this goal. So, as far as this request is concerned, it is done as requested. The Bootstrap 5 version, you will have to use other means of applying to a parent row.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.