Last active
          March 4, 2022 20:44 
        
      - 
      
- 
        Save rafaehlers/243b757de60f79241987a9d8239c0111 to your computer and use it in GitHub Desktop. 
    Highlight an entire row if field condition is met (only works with Table View)
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php // DO NOT COPY THIS LINE | |
| add_filter( 'gravityview/template/table/entry/class', function( $class, $context ) { | |
| $view_id = $context->view->ID; | |
| if($view_id == 46){ // Modify to target only View with specific ID (46 in this case) | |
| if ( $context->entry[1] == '1' ) { | |
| $class .= ' highlight-yes'; // If field ID 1's value is equal to 1 then add the CSS class | |
| }elseif( $context->entry[1] == '0' ){ | |
| $class .= ' highlight-no'; // If field ID 1's value is equal to 0 then add the CSS class | |
| }elseif( $context->entry[1] == '2' ){ | |
| $class .= ' highlight-maybe'; // If field ID 1's value is equal to 2 then add the CSS class | |
| } | |
| } | |
| return $class; | |
| }, 10, 2 ); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment