// Text colour is based on whether block has a gradient or not
$text_colour = $this->hasGradient($block) ? 'light' : 'dark';
+
+ // Get layout settings for cement.js
+ $layout_data = $this->_layoutData($block['layout']);
- $res .= '<div class="feature-block text-'. $text_colour .' '. $block['layout'] .'" id="'. $id .'">';
+ $res .= '<div class="feature-block text-'. $text_colour .' '. $block['layout'] .'" id="'. $id .'" '. $layout_data .'>';
$res .= $this->_CSS($id, $block);
return is_array($block['background_image']);
}
+ protected function _layoutData($layout) {
+
+ switch($layout) {
+ case 'square-top':
+ case 'square-bottom':
+ $w = 2;
+ $h = 2;
+ break;
+ case 'rectangle-right':
+ case 'rectangle-bottom':
+ $w = 3;
+ $h = 2;
+ break;
+ case 'small-rectangle-tall':
+ $w = 1;
+ $h = 2;
+ break;
+ case 'small-rectangle-wide':
+ $w = 2;
+ $h = 1;
+ }
+
+ if (!$w || !$h) return '';
+
+ return 'data-w="'. $w .'" data-h="'. $h .'"';
+ }
+
protected function _CSS($id, $block) {
$gradient = $block['background_gradient'];
function load_features() {
- $(".feature-blocks").masonry({
- itemSelector: ".feature-block",
- //fitWidth: true,
- columnWidth: ".small-rectangle-tall",
- transitionDuration: 0,
+ $('.feature-blocks').cement({
+ columns: 6,
+ columnMinWidth: 200,
+ horizontalGutter: 0,
+ verticalGutter: 0
});
}
\ No newline at end of file