Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The following error occurs when I uncheck the default table format settings of "Add views row classes", "Add striping (odd/even), first/last row classes", and "Override normal sorting if click sorting is used". The error is gone if I check the three options as default again.
Notice: Undefined variable: row_classes in include() (line 38 of C:\wamp\www\sites\all\modules\views\theme\views-view-table.tpl.php).
Comment | File | Size | Author |
---|---|---|---|
#7 | views-undefined_row_classes_on_empty_table-1597002-7.patch | 602 bytes | Olarin |
#1 | 1597002.patch | 416 bytes | dawehner |
Comments
Comment #1
dawehnerHere is a small patch which should fix that issue.
Comment #2
DrupalDan CreditAttribution: DrupalDan commentedthank for the patch dawehner. Yes, it works and everything seems pretty good.
Comment #3
tim.plunkettYet Another Undefined Index Error
Comment #4
dawehnerThanks for testing the patch!
Committed to 7.x-3.x and 8.x-3.x
Comment #6
BoobaaSeems like it's not enough; I am running into the same error if I have "Add views row classes" ON, "Add striping (odd/even), first/last row classes" OFF, "Override normal sorting if click sorting is used" OFF, the view has no results, but the view does have a message to be displayed IN the table if there is no result. In this case it seems like that while there are no (result) rows in template_preprocess_views_view_table() (so $vars['rows_classes'] will NOT be set), there ARE (table) rows to be displayed, so we are running into the error because there's no $rows_classes variable set.
I must admit that one can get rid of the error message by enabling "Add striping (odd/even), first/last row classes", but that's only masking the problem.
Comment #7
Olarin CreditAttribution: Olarin commentedThis patch is slightly careless as it will inadvertently remove "views-row-first" and "views-row-last" from the empty table row if they were otherwise being set, but perhaps this is desirable as it's not really a normal row anyway?
Comment #9
Olarin CreditAttribution: Olarin commentedComment #14
Olarin CreditAttribution: Olarin commented