Created
October 14, 2014 11:06
-
-
Save DavidCramer/395d3d1e09c2874a152d to your computer and use it in GitHub Desktop.
Setting Caldera Forms to use Zurb Foundation Grid instead of Bootstrap.
This file contains 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 | |
// Simple snippet to show how to use Foundation's grid over the built in Bootstrap grid. | |
add_filter('caldera_forms_render_grid_settings', 'setup_foundation_grid', 10, 2); | |
function setup_foundation_grid($grid, $form){ | |
// Bootstrap grid sized to foundation equivilents | |
$grid_sizes = array( | |
'xs' => 'small', | |
'sm' => 'small', | |
'md' => 'medium', | |
'lg' => 'large', | |
); | |
// set grid size to foundation size from sizes array | |
$grid_size = $grid_sizes[ $form['settings']['responsive']['break_point'] ]; | |
// column_before = column start | |
// %1$ sets the Column ID, %2$d Sets the span size, %3$d sets additional column classes | |
$grid['column_before'] = '<div %1$s class="' . $grid_size . '-%2$d columns %3$s" style="min-height: 1px;">'; | |
// the min-height fixes an issue where an empty column doesn't show since foundation uses float:left | |
return $grid; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment