Skip to content

Commit

Permalink
Merge pull request #211 from vektor-inc/fix/blockType-error
Browse files Browse the repository at this point in the history
[ Bug fix ] Fixed errors that occur on the site editor.
  • Loading branch information
kurudrive authored Jul 4, 2024
2 parents c920bb1 + e3e5f93 commit 8470a85
Show file tree
Hide file tree
Showing 7 changed files with 739 additions and 729 deletions.
37 changes: 22 additions & 15 deletions patterns-data/class-register-patterns-from-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
/**
* 生成先のテーマ・プラグインでブロックパターン情報を読み込んで登録
*
* @package VK Block Pattern Plugin Generator
* @package vektor-inc/vk-block-pattern-plugin-generator
* @version 0.8.8
*/

namespace wp_content\plugins\vk_block_patterns\patterns_data;
Expand All @@ -28,7 +29,7 @@ public function __construct() {
* @return string 最小化したCSSファイル
*/
public static function load_inline_css( $filename = 'style.css' ) {
$style_path = wp_normalize_path( dirname( __FILE__ ) . '/' . $filename );
$style_path = wp_normalize_path( __DIR__ . '/' . $filename );
$style_url = str_replace( wp_normalize_path( ABSPATH ), site_url() . '/', $style_path );
$dynamic_css = '';
if ( file_exists( $style_path ) ) {
Expand Down Expand Up @@ -77,7 +78,7 @@ public static function print_pattern_editor_css() {
public static function register_template() {

// これは読み込み側では存在しないクラスなので要対応.
$json_dir_path = wp_normalize_path( dirname( __FILE__ ) . '/' );
$json_dir_path = wp_normalize_path( __DIR__ . '/' );

if ( function_exists( 'register_block_pattern_category' ) && function_exists( 'register_block_pattern' ) ) {

Expand Down Expand Up @@ -168,29 +169,35 @@ public static function register_template() {
if ( in_array( $site_lang, (array) $val['languages'], true ) ) {
// 本来 $val['post_status'] は必ず必ず入ってくる。リリース前のデータ対応なので2021年3月以降削除可.
if ( ! isset( $val['post_status'] ) || 'publish' === $val['post_status'] ) {
$pattern_properties = array(
'title' => $val['title'],
'categories' => $val['categories'],
'content' => $val['content'],
);
if ( ! empty( $val['blockTypes'] ) ) {
$pattern_properties['blockTypes'] = $val['blockTypes'];
}
register_block_pattern(
$val['post_name'],
array(
'title' => $val['title'],
'categories' => $val['categories'],
'content' => $val['content'],
'blockTypes' => $val['blockTypes'],
)
$pattern_properties
);
}
}
} else {
// 英語のパターンのみ登録するモード.
if ( in_array( mb_strtolower( 'en_US' ), (array) $val['languages'], true ) ) {
if ( ! isset( $val['post_status'] ) || 'publish' === $val['post_status'] ) {
$pattern_properties = array(
'title' => $val['title'],
'categories' => $val['categories'],
'content' => $val['content'],
);
if ( ! empty( $val['blockTypes'] ) ) {
$pattern_properties['blockTypes'] = $val['blockTypes'];
}
register_block_pattern(
$val['post_name'],
array(
'title' => $val['title'],
'categories' => $val['categories'],
'content' => $val['content'],
'blockTypes' => $val['blockTypes'],
)
$pattern_properties
);
}
}
Expand Down
466 changes: 233 additions & 233 deletions patterns-data/template-all.json

Large diffs are not rendered by default.

72 changes: 36 additions & 36 deletions patterns-data/template-exclude-vk.json

Large diffs are not rendered by default.

410 changes: 205 additions & 205 deletions patterns-data/template-for-vk-free.json

Large diffs are not rendered by default.

466 changes: 233 additions & 233 deletions patterns-data/template-for-vk-pro.json

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
Contributors: vektor-inc,kurudrive,rickaddison7634,kaorock72,una9,shimotomoki,doshimaf
Donate link:
Tags: Guternberg, Block Pattern
Requires at least: 6.0
Tested up to: 6.2
Stable tag: 1.32.1.0
Requires PHP: 7.2
Requires at least: 6.2
Tested up to: 6.6
Stable tag: 1.32.2.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -16,8 +16,11 @@ When you activate this plugin that create new custom post type for custom block

== Changelog ==

= 1.32.2 =
[ Bug fix ] Fixed errors that occur on the site editor.

= 1.32.1 =
[ Bug fix ] The auto insert supports the post type created by Custom Post Type UI.
[ Bug fix ] The auto insert supports the post type created by Custom Post Type UI.

= 1.32.0 =
[ Update ] Adjust all patterns
Expand Down
4 changes: 2 additions & 2 deletions vk-block-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Plugin Name: VK Block Patterns
* Plugin URI: https://github.com/vektor-inc/vk-block-patterns
* Description: You can make and register your original custom block patterns.
* Version: 1.32.1.0
* Requires at least: 6.0
* Version: 1.32.2.0
* Requires at least: 6.2
* Author: Vektor,Inc.
* Author URI: https://vektor-inc.co.jp
* Text Domain: vk-block-patterns
Expand Down

0 comments on commit 8470a85

Please sign in to comment.