Skip to content

Commit

Permalink
Restore helper_alternate_class() function
Browse files Browse the repository at this point in the history
This is a temporary measure to improve backwards compatibility of 1.3,
the function will be removed again in the next release.

Fixes #17522 (see also issue #17437)
  • Loading branch information
dregad committed Nov 8, 2014
1 parent c134cb5 commit 25951d8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions core/helper_api.php
Expand Up @@ -76,6 +76,28 @@ function helper_alternate_colors( $p_index, $p_odd_color, $p_even_color ) {
}
}

/**
* alternate classes for table rows
* If no index is given, continue alternating based on the last index given
* @param int $p_index
* @param string $p_odd_class default: row-1
* @param string $p_even_class default: row-2
* @return string
*/
function helper_alternate_class( $p_index = null, $p_odd_class = 'row-1', $p_even_class = 'row-2' ) {
static $t_index = 1;

if( null !== $p_index ) {
$t_index = $p_index;
}

if( 1 == $t_index++ % 2 ) {
return "class=\"$p_odd_class\"";
} else {
return "class=\"$p_even_class\"";
}
}

/**
* Transpose a bidimensional array
*
Expand Down

0 comments on commit 25951d8

Please sign in to comment.