add_row_css( $post_id, $ri, array( '.panel-has-style > .panel-row-style' ), array( 'border: 1px solid red', ) ); */ } function smartlib_custom_page_builder_css() { wp_enqueue_style( 'smartlib_main' ); $custom_css = " .panel-row-style{ background-image: none!important; background-color: none!important; } .panel-widget-style{ padding: 0!important } .panel-grid{ margin-left: -15px!important; margin-right: -15px!important; }"; wp_add_inline_style('smartlib_main', $custom_css); } add_action('wp_enqueue_scripts', 'smartlib_custom_page_builder_css'); function smartlib_panels_css_object($css, $panels_data, $post_id, $layout_data) { $css->add_row_css(false, false, false, array( 'border: 1px solid red', )); return $css; } /** * Add new widget fields * @param $fields * @return mixed */ function smartlib_widget_style_fields($fields) { $fields['half_column'] = array( 'name' => __('Half Column', 'bootframe-core'), 'type' => 'checkbox', 'group' => 'attributes', 'description' => __('Use this in the fluid section to force widget display in column.', 'bootframe-core'), 'priority' => 1, ); return $fields; } /** * Add new row fields * @param $fields * @return mixed */ function smartlib_row_style_fields($fields) { $fields['parllax_sroll'] = array( 'name' => __('Parallax scrolling ', 'bootframe-core'), 'type' => 'checkbox', 'group' => 'design', 'description' => __('Add parallax scroll effect', 'bootframe-core'), 'priority' => 5, ); $fields['overlay_background_color'] = array( 'name' => __('Overlay background color', 'bootframe-core'), 'type' => 'color', 'group' => 'design', 'description' => __('Adds colored layer with some transparency over background image', 'bootframe-core'), 'priority' => 6, ); /* $fields['fluid_section'] = array( 'name' => __('Fluid Row', 'bootframe-core'), 'type' => 'checkbox', 'group' => 'attributes', 'description' => __('Use fluid row for a full width container, spanning the entire width of your viewport.', 'bootframe-core'), 'priority' => 1, ); */ $fields['no_padding_columns'] = array( 'name' => __('No Padding Columns', 'bootframe-core'), 'type' => 'checkbox', 'group' => 'attributes', 'description' => __('All columns in this row have no padding.', 'bootframe-core'), 'priority' => 3, ); $fields['dark_section'] = array( 'name' => __('Dark Section', 'bootframe-core'), 'type' => 'checkbox', 'group' => 'design', 'description' => __('Section with dark background and light text', 'bootframe-core'), 'priority' => 1, ); $fields['background_image_attachment_smartlib'] = array( 'name' => __('Background Image', 'bootframe-core'), 'type' => 'image', 'group' => 'design', 'description' => __('Background image of the row', 'bootframe-core'), 'priority' => 6, ); unset($fields['background_image_attachment']); return $fields; } /** * Add new row attributes * @param $attributes * @param $args * @return array */ function smartlib_row_style_attributes($attributes, $args) { if (isset($attributes['class'])) array_push($attributes['class'], 'smartlib-widgets-panel-row'); if (isset($args) && is_array($args) && isset($attributes) && is_array($attributes)) { if (!empty($args['fluid_section'])) { array_push($attributes['class'], 'smartlib-full-width-section'); } if (!empty($args['no_padding_columns'])) { array_push($attributes['class'], 'smartlib-no-padding-row'); } if (!empty($args['parllax_sroll']) && smartlib_check_row_type($args)) { $attributes['data-type'] = array(); array_push($attributes['data-type'], 'background'); array_push($attributes['class'], 'smartlib-paralax-container'); } if (!empty($args['overlay_background_color']) && smartlib_check_row_type($args)) { $attributes['data-overlay-color'] = array(); array_push($attributes['class'], 'smartlib-overlay-over-background'); array_push($attributes['data-overlay-color'], $args['overlay_background_color']); } if (!empty($args['dark_section'])) { array_push($attributes['class'], 'smartlib-dark-section'); } } return $attributes; } /** * Add new widget atributes in panel * @param $attributes * @param $args * @return mixed */ function smartlib_widget_style_attributes($attributes, $args) { //array_push($attributes['class'],'panel'); //array_push($attributes['class'],'widget'); //array_push($attributes['class'],'smartlib-widget'); if (!empty($args['half_column'])) { array_push($attributes['class'], 'half-content-container'); } return $attributes; } /** * If row is full-stretched add new container * @param $panels_data_grid * @param $grid_attributes * @return string */ function smartlib_add_html_before_row($panels_data_grid, $grid_attributes) { $arguments = array(); $arguments['class'] = array(); $arguments['style'] = ''; $section_class = ''; $section_attributes = ''; //get all style attrubutes from $grid_attributes $grid_args = $grid_attributes['style']; /** * Remove values because used on lower level * (includes paddig in full strech sections */ if (isset($grid_attributes['style']['row_stretch']) && $grid_attributes['style']['row_stretch'] != 'full-stretched') { if (isset($grid_args['padding'])) unset($grid_args['padding']); } if (isset($grid_args['border_color'])) unset($grid_args['border_color']); //merge additional param - prevent from reset $args = array_merge($grid_args, array('not_remove_attributes' => 1)); $style = apply_filters('siteorigin_panels_row_style_attributes', $arguments, $args); $style_substring = ''; if (isset($grid_attributes['style']['bottom_margin'])) { $style_substring .= 'margin-bottom:' . $grid_attributes['style']['bottom_margin'] . ';'; } //new version Site Origin if (isset($grid_args['background'])) { $style_substring .= 'background-color:' . $grid_args['background'] . ';'; } if (isset($grid_args['padding'])) { $style_substring .= 'padding:' . $grid_args['padding'] . ';'; } if (isset($grid_args['background_image_attachment_smartlib'])) { $style_substring .= 'background-image: url(' . wp_get_attachment_url($grid_args['background_image_attachment_smartlib']) . ');'; } if (isset($grid_args['background_display'])) { $style_substring .= 'background-size:' . $grid_args['background_display'] . ';'; } $style_string = isset($style['style']) ? ' style="' . $style['style'] . $style_substring . '"' : ''; /*Check smartlib additional attrubutes*/ $section_class .= isset($grid_args['dark_section']) && !empty($grid_args['dark_section']) ? ' smartlib-dark-section' : ''; $section_class .= isset($grid_args['parllax_sroll']) && !empty($grid_args['parllax_sroll']) ? ' smartlib-paralax-container' : ''; $section_class .= isset($grid_args['overlay_background_color']) && !empty($grid_args['overlay_background_color']) ? ' smartlib-overlay-over-background' : ''; $section_attributes .= isset($grid_args['overlay_background_color']) && !empty($grid_args['overlay_background_color']) ? ' data-type="background"' : ''; $section_attributes .= isset($grid_args['overlay_background_color']) && !empty($grid_args['overlay_background_color']) ? ' data-overlay-color="' . $grid_args['overlay_background_color'] . '"' : ''; if (isset($grid_attributes['style']['row_stretch'])) { if ($grid_attributes['style']['row_stretch'] == 'full-stretched') { echo '
'; } elseif ($grid_attributes['style']['row_stretch'] == 'full') { echo '
'; } else { echo '
'; } } else { echo '
'; } } /** * * If row is full-stretched add new container - close tag * @param $panels_data_grid * @param $grid_attributes * @return string */ function smartlib_add_html_after_row($panels_data_grid, $grid_attributes) { return '
'; } /** * If row is full-stretched reset style atributes in panel-row * @param $attributes * @param $args * @return mixed */ function smartlib_row_reset_style_attributes($attributes, $args) { if (isset($attributes['data-stretch-type']) && $attributes['data-stretch-type'] == 'full-stretched' && !isset($args['not_remove_attributes'])) { $attributes['style'] = array(); } return $attributes; } /** * Check type of row - return true if full-streched * @param $args * @return bool */ function smartlib_check_row_type($args) { return (bool)(isset($args['style']['row_stretch']) && $args['style']['row_stretch'] != 'full-stretched'); } /** * Cahnge default page builder gutter * @return mixed */ function smartlib_change_gutter() { return Smartlib_Config::getInstance()->project_default_sizes['project_gutter_width'] . 'px'; }