Skip to content

Commit

Permalink
Merge branch 'release/2.20.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Misplon committed Dec 29, 2022
2 parents ec462e7 + bf7b0cd commit d226339
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 4 deletions.
4 changes: 3 additions & 1 deletion inc/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,9 @@ function render( $post_id = false, $enqueue_css = true, $panels_data = false, &
$GLOBALS[ 'SITEORIGIN_PANELS_PREVIEW_RENDER' ] = true;
}

$layout_data = $this->get_panels_layout_data( $panels_data );
if ( ! empty( $layout_data ) ) {
$layout_data = $this->get_panels_layout_data( $panels_data );
}
$layout_data = apply_filters( 'siteorigin_panels_layout_data', $layout_data, $post_id );

ob_start();
Expand Down
33 changes: 31 additions & 2 deletions inc/styles-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,20 @@ class="style-field style-field-<?php echo sanitize_html_class( $sub_field['type'


<?php
break;
default:
// No standard style fields used. See if there's a custom one set.
$custom_style_field = apply_filters( 'siteorigin_panels_style_field_'. $field['type'],
$field,
$field_name,
$current,
$field_id
);

if ( ! empty( $custom_style_field ) ) {
echo $custom_style_field;
}

break;
}

Expand Down Expand Up @@ -539,8 +553,23 @@ function sanitize_style_fields( $section, $styles, $sub_field = array() ) {
$return = $return + $this->sanitize_style_fields( $k, $styles, $field['fields'] );
}
default:
// Just pass the value through.
$return[ $k ] = $styles[ $k ];
// No standard style fields used. See if there's a custom one set.
$custom_style_sanitized_data = apply_filters(
'siteorigin_panels_style_field_sanitize_'. $field['type'],
$styles[ $k ],
$k,
$field,
$styles,
$sub_field
);

if ( ! empty( $custom_style_sanitized_data ) ) {
$return[ $k ] = $custom_style_sanitized_data;
} else {
// Just pass the value through.
$return[ $k ] = $styles[ $k ];
}

break;

}
Expand Down
8 changes: 7 additions & 1 deletion js/siteorigin-panels/view/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = Backbone.View.extend( {
dataField: false,
currentData: '',
contentPreview: '',
initialContentPreviewSetup: false,

attachedToEditor: false,
attachedVisible: false,
Expand Down Expand Up @@ -785,12 +786,17 @@ module.exports = Backbone.View.extend( {
},
function ( content ) {
// Post content doesn't need to be generated on load while contentPreview does.
if ( this.contentPreview && content.post_content !== '' ) {
if (
this.contentPreview &&
content.post_content !== '' &&
this.initialContentPreviewSetup
) {
this.updateEditorContent( content.post_content );
}

if ( content.preview !== '' ) {
this.contentPreview = content.preview;
this.initialContentPreviewSetup = true;
}
}.bind( this )
);
Expand Down
1 change: 1 addition & 0 deletions js/siteorigin-panels/view/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ module.exports = Backbone.View.extend( {
}
soBackgroundImageVisibility();
$background_image.find( '[name="style[background_image_attachment]"], [name="style[background_image_attachment_fallback]"]' ).on( 'change', soBackgroundImageVisibility );
$background_image.find( '.remove-image' ).on( 'click', soBackgroundImageVisibility );
}

// Conditionally show Border related settings.
Expand Down
5 changes: 5 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ SiteOrigin Premium includes access to our professional email support service, pe

== Changelog ==

= 2.20.2 - 29 December 2022 =
* Styles: Improved `Background Image Display` and `Size` settings conditional display behavior.
* Classic Editor: Prevented potential notice when opening a saved widget.
* Developer: Added custom style field type support via `siteorigin_panels_style_field_*`, and `siteorigin_panels_style_field_sanitize_*`.

= 2.20.1 - 09 December 2022 =
* Darkened default cell admin background color.
* Removed `@font-face` query string.
Expand Down

0 comments on commit d226339

Please sign in to comment.