| 1 |
<?php |
| 2 |
|
| 3 |
class Meow_MGL_Builders_Square extends Meow_MGL_Builders_Core { |
| 4 |
|
| 5 |
public function __construct( $atts, $infinite, $isPreview = false ) { |
| 6 |
parent::__construct( $atts, $infinite, $isPreview ); |
| 7 |
$this->layout = 'square'; |
| 8 |
} |
| 9 |
|
| 10 |
function inline_css() { |
| 11 |
$options = get_option( Meow_MGL_Core::get_plugin_option_name(), null ); |
| 12 |
$class_id = '#' . $this->class_id; |
| 13 |
$gutter = isset( $this->atts['gutter'] ) ? $this->atts['gutter'] : ( $options['square_gutter'] ?? 10 ); |
| 14 |
$columns = isset( $this->atts['columns'] ) ? $this->atts['columns'] : ( $options['square_columns'] ?? 5 ); |
| 15 |
$isPreview = $this->isPreview; |
| 16 |
ob_start(); |
| 17 |
include dirname( __FILE__ ) . '/square.css.php'; |
| 18 |
$html = ob_get_clean(); |
| 19 |
return $html; |
| 20 |
} |
| 21 |
|
| 22 |
function build_next_cell( $id, $data ) { |
| 23 |
$html = parent::build_next_cell( $id, $data ); |
| 24 |
$columns = ( isset( $this->atts['columns'] ) ? $this->atts['columns'] : Meow_MGL_Core::get_plugin_option( 'square_columns', 5 ) ) + 1; |
| 25 |
$html = str_replace( '100vw', 100 / $columns . 'vw', $html ); |
| 26 |
return $html; |
| 27 |
} |
| 28 |
|
| 29 |
} |
| 30 |
|
| 31 |
?> |
| 32 |
|