/** * Create a Foundation block grid. * * @link http://foundation.zurb.com/docs/grid.php * @access public * @param array $blocks the content of the blocks (default: array()). * @param int $up the number of blocks of this block grid to display * horizontally (default: 2). * @param mixed $mobile_up the optional number of blocks to display per row on mobile devices (default: null). * @param string $grid_class an optional class of the grid (default: ''). * @param string $block_class an optional class of the blocks (default: ''). * @return string the HTML code with the block grid. */ function block_grid($blocks = array(), $up = 2, $mobile_up = null, $grid_class = '', $block_class = '') { $up = _number_to_text($up) . '-up'; $mobile_up = !is_null($mobile_up) ? ' mobile-' . _number_to_text($mobile_up) . '-up' : ''; $grid_class = $grid_class != '' ? ' ' . $grid_class : $grid_class; $block_class = $block_class != '' ? ' class="' . $block_class . '"' : $block_class; $result = ''; $result .= '<ul class="block-grid ' . $up . $mobile_up . $grid_class . '"' . '>'; foreach ($blocks as $block) { $result .= '<li' . $block_class . '>' . $block . '</li>'; } $result .= '</ul>'; return $result; }
/** * Create a Foundation columns div element. * * @link http://foundation.zurb.com/docs/grid.php * @param string $data the content of the columns element. * @param int $number the number of columns, any number [1-12], defaults to 12. * @param string $class any optional classes of the columns div. * @param int $mobile an optional mobile columns setting, any number [1-4]. * @return string the columns div html. */ function columns($data = '', $number = 12, $class = '', $mobile = null) { $class = $class != '' ? $class . ' ' : $class; $number = _number_to_text($number) . ' '; $mobile = $mobile != null ? 'mobile-' . _number_to_text($mobile) . ' ' : $mobile; return "<div class=\"" . $class . $number . $mobile . "columns\">" . $data . "</div>"; }