Skip to content

Commit

Permalink
Merge pull request #2 from justcoded/page_builder_2.5
Browse files Browse the repository at this point in the history
Support for SO Page builder 2.5
  • Loading branch information
aprokopenko committed May 12, 2017
2 parents 3c576f7 + ea1eb40 commit 71ad4c6
Show file tree
Hide file tree
Showing 12 changed files with 959 additions and 689 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace JustCoded\ThemeFramework\SOPanels;
namespace JustCoded\ThemeFramework\PageBuilder\v25\Layouts;

/**
* Class RowLayout
Expand Down Expand Up @@ -55,6 +55,28 @@ public function __construct() {
}
}

/**
* Additional options to add into Row option controls
*
* Field element should has a format similar to this:
*
* '{field}' => array(
* 'name' => '{Field Title}',
* 'type' => 'select', // available: text, select, color, measurement
* 'group' => 'layout', // available: attributes, layout, design
* 'options' => array( // select options
* 'No',
* 'Yes',
* ),
* 'priority' => 15, // order weigth
* ),
*
* @return array
*/
public function options() {
return array();
}

/**
* Adjust html attributes for row wrapper div
*
Expand All @@ -63,7 +85,7 @@ public function __construct() {
*
* @return array update attributes
*/
public function row_wrapper( $attributes, $panel_data ) {
public function row( $attributes, $panel_data ) {
return $attributes;
}

Expand All @@ -75,7 +97,7 @@ public function row_wrapper( $attributes, $panel_data ) {
*
* @return array update attributes
*/
public function row( $attributes, $style_data ) {
public function row_inner( $attributes, $style_data ) {
return $attributes;
}

Expand All @@ -87,7 +109,7 @@ public function row( $attributes, $style_data ) {
*
* @return array update attributes
*/
public function cell_wrapper( $attributes, $panel_data ) {
public function cell( $attributes, $panel_data ) {
return $attributes;
}

Expand All @@ -99,7 +121,7 @@ public function cell_wrapper( $attributes, $panel_data ) {
*
* @return array update attributes
*/
public function cell( $attributes, $style_data ) {
public function cell_inner( $attributes, $style_data ) {
return $attributes;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
<?php
namespace JustCoded\ThemeFramework\SOPanels;
namespace JustCoded\ThemeFramework\PageBuilder\v25\Layouts;

/**
* Class Grid12RowLayout
*
* @package JustCoded\ThemeFramework\SOPanels
*/
class Grid12RowLayout extends RowLayout {
class RwdRowLayout extends RowLayout {
/**
* ID
*
* @var string
*/
public static $ID = 'grid-12';
public static $ID = 'grid12';

/**
* Title
*
* @var string
*/
public static $TITLE = 'Auto Grid: 12 columns';
public static $TITLE = 'Responsive Columns';

/**
* Grid max columns size
*
* @var int
*/
public $grid_size_columns = 12;

/**
* Adjust html attributes for cell wrapper
Expand All @@ -29,12 +36,12 @@ class Grid12RowLayout extends RowLayout {
*
* @return array update attributes
*/
public function cell_wrapper( $attributes, $panel_data ) {
public function cell( $attributes, $panel_data ) {
$cell = $panel_data['grid_cells'][ $this->cell_index ];
$grid = $panel_data['grids'][ $cell['grid'] ];

$cell_postfix = round( 12 * $cell['weight'] );
$bootstrap_class = 'jgrid-col-' . $cell_postfix;
$cell_postfix = round( $this->grid_size_columns * $cell['weight'] );
$bootstrap_class = 'pb-col-sz-' . $cell_postfix;

$attributes['class'] .= ' ' . $bootstrap_class;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace JustCoded\ThemeFramework\SOPanels;
namespace JustCoded\ThemeFramework\PageBuilder\v25\Layouts;

/**
* Class WidgetLayout
Expand Down Expand Up @@ -42,17 +42,25 @@ public function __construct() {
}

/**
* Replace wrapper classes string
* Additional options to add into Row option controls
*
* @param array $classes html attribute.
* @param array $style_data selected style options.
* @param string $widget widget class name.
* @param array $instance widget data.
* Field element should has a format similar to this:
*
* '{field}' => array(
* 'name' => '{Field Title}',
* 'type' => 'select', // available: text, select, color, measurement
* 'group' => 'layout', // available: attributes, layout, design
* 'options' => array( // select options
* 'No',
* 'Yes',
* ),
* 'priority' => 15, // order weigth
* ),
*
* @return array
*/
public function wrapper_classes( array $classes, $style_data, $widget, $instance ) {
return $classes;
public function options() {
return array();
}

/**
Expand All @@ -67,4 +75,18 @@ public function widget( $attributes, $style_data ) {
return $attributes;
}

/**
* Replace inner div classes string
*
* @param array $classes html attribute.
* @param array $style_data selected style options.
* @param string $widget widget class name.
* @param array $instance widget data.
*
* @return array
*/
public function widget_inner_classes( array $classes, $style_data, $widget, $instance ) {
return $classes;
}

}

0 comments on commit 71ad4c6

Please sign in to comment.