Skip to content

Commit

Permalink
Updating plugin to v1.4.5
Browse files Browse the repository at this point in the history
* Fixed JS when applying Organic Custom page template
* Updated Widget Area Block to work within nested blocks
  • Loading branch information
itsdavidmorgan committed Feb 7, 2020
1 parent 359d16c commit 0ed19d3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: jqlee85, itsdavidmorgan, organicthemes, raid33, wordpresspagebuilder
Donate link: https://organicthemes.com
Tags: builder, customizer, widgets, slideshows, testimonials, portfolio, fontawesome, icons, pricing tables, page builder, full-width sections, custom widget areas, bundle, custom widgets, widget area, block
Stable tag: 1.4.4
Stable tag: 1.4.5
Requires at least: 4.8
Tested up to: 5.3
License: GPLv2 or later
Expand Down Expand Up @@ -151,6 +151,10 @@ A: Yes. However, builder widgets are primarily added within the WordPress Custom

== Changelog ==

= 1.4.5 =
* Fixed JS when applying Organic Custom page template
* Updated Widget Area Block to work within nested blocks

= 1.4.4 =
* Added top and bottom alignment styles for Featured Product widget
* Updated public script enqueue for Pricing Table widget
Expand Down
27 changes: 27 additions & 0 deletions admin/blocks/class-organic-widgets-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,37 @@ public function update_widgets_log( $post_id, $post, $update ) {
}
}

$saved_widgets = self::find_saved_widgets_recursive( $saved_widgets, $post_id, $blocks );

update_option( 'organic_widget-area', $saved_widgets, true );

}

/**
* Walk the post content blocks recursively and find widget area blocks.
*
* @param array $saved_widgets
* @param int $post_id post id.
* @param array $blocks
* @return array $saved_widgets
*/
protected static function find_saved_widgets_recursive( &$saved_widgets, $post_id, $blocks ) {

if ( ! empty( $blocks ) ) {
foreach ( $blocks as $block ) {
if ( isset( $block['blockName'] ) && 'organic/widget-area' === $block['blockName'] ) {
if ( '' !== trim( $block['attrs']['widget_area_title'] ) ) {
$saved_widgets[ $post_id ][] = $block['attrs']['widget_area_title'];
}
} elseif ( isset( $block['innerBlocks'] ) && ! empty( $block['innerBlocks'] ) ) {
self::find_saved_widgets_recursive( $saved_widgets, $post_id, $block['innerBlocks'] );
}
}
}

return $saved_widgets;
}

/**
* Update when a post deleted for widgets in options.
*
Expand Down
2 changes: 1 addition & 1 deletion admin/js/organic-widgets-editor-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}

function hideEditor () {
var wpContentEditorDiv = $('#postdivrich, #editor .editor-block-list__layout')
var wpContentEditorDiv = $('#postdivrich, #editor .block-editor-block-list__layout, #editor .editor-block-list__layout')
var organicCustomEditDiv = $(document.createElement('div'))

if (!organicWidgets.isCustomTemplate) {
Expand Down
4 changes: 2 additions & 2 deletions organic-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Plugin Name: Organic Builder Widgets
* Plugin URI: https://organicthemes.com/organic-customizer-widgets
* Description: Transform the core WordPress Customizer into a page builder. Display and arrange widgets on any page as beautiful content sections, such as featured content slideshows, testimonials, team members, portfolios, feature lists, pricing tables and more. Whoa, cool.
* Version: 1.4.4
* Version: 1.4.5
* Author: Organic Themes
* Author URI: https://organicthemes.com
* License: GPL-2.0+
Expand All @@ -19,7 +19,7 @@
*/

// Current Version (Keep in sync with Version # above).
define( 'ORGANIC_WIDGETS_CURRENT_VERSION', '1.4.4' );
define( 'ORGANIC_WIDGETS_CURRENT_VERSION', '1.4.5' );

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
Expand Down

0 comments on commit 0ed19d3

Please sign in to comment.