| 1 |
<?php |
| 2 |
|
| 3 |
class Meow_MGL_Builders_Tiles extends Meow_MGL_Builders_Core { |
| 4 |
|
| 5 |
public function __construct( $atts, $infinite, $isPreview = false ) { |
| 6 |
parent::__construct( $atts, $infinite, $isPreview ); |
| 7 |
$this->layout = 'tiles'; |
| 8 |
} |
| 9 |
|
| 10 |
function inline_css() { |
| 11 |
$class_id = '#' . $this->class_id; |
| 12 |
|
| 13 |
$isPreview = $this->isPreview; |
| 14 |
|
| 15 |
$options = get_option( Meow_MGL_Core::get_plugin_option_name(), null ); |
| 16 |
|
| 17 |
$gutter = []; |
| 18 |
if ( isset( $this->atts['gutter'] ) ) { |
| 19 |
$gutter['desktop'] = $this->atts['gutter']; |
| 20 |
$gutter['tablet'] = $this->atts['gutter']; |
| 21 |
$gutter['mobile'] = $this->atts['gutter']; |
| 22 |
} |
| 23 |
else { |
| 24 |
$gutter['desktop'] = $options['tiles_gutter'] ?? 10; |
| 25 |
$gutter['tablet'] = $options['tiles_gutter_tablet'] ?? 10; |
| 26 |
$gutter['mobile'] = $options['tiles_gutter_mobile'] ?? 10; |
| 27 |
} |
| 28 |
|
| 29 |
$density = Meow_MGL_Core::get_tiles_density( $this->atts ); |
| 30 |
|
| 31 |
ob_start(); |
| 32 |
include dirname( __FILE__ ) . '/tiles.css.php'; |
| 33 |
$html = ob_get_clean(); |
| 34 |
return $html; |
| 35 |
} |
| 36 |
|
| 37 |
function build_inline_attributes( $id, $data ) { |
| 38 |
if ( isset( $data['meta'] ) && isset( $data['meta']['width'] ) && isset( $data['meta']['height'] ) ) { |
| 39 |
return ' data-mgl-id="' . $id . '" data-mgl-width="' . $data['meta']['width'] . '" data-mgl-height="' . |
| 40 |
$data['meta']['height'] . '"'; |
| 41 |
} |
| 42 |
return null; |
| 43 |
} |
| 44 |
|
| 45 |
function build_next_cell( $id, $data ) { |
| 46 |
$html = parent::build_next_cell( $id, $data ); |
| 47 |
return $html; |
| 48 |
} |
| 49 |
|
| 50 |
} |
| 51 |
|
| 52 |
?> |
| 53 |
|