Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ node_modules/

# dotenv environment variables file
.env

# Composer
composer.lock
2 changes: 1 addition & 1 deletion .plugin-data
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "1.1.2",
"version": "1.2.0",
"slug": "blockparty-iframe"
}
2 changes: 1 addition & 1 deletion .wordpress-org/blueprints/blueprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"pluginData": {
"resource": "git:directory",
"url": "https://github.com/BeAPI/blockparty-iframe",
"ref": "1.1.2",
"ref": "1.2.0",
"refType": "tag"
},
"options": {
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/).

## [1.2.0] - 2026-04-22

### Changed

- **Dynamic block rendering**: The iframe is rendered on the server via `BlockRenderer` and a `render_callback` (same pattern as blockparty-post-sharing). Post content stores block attributes only; frontend markup is built at display time.
- **Plugin bootstrap**: Register the block with `register_block_type()` and `render_callback` instead of metadata-collection-only registration.

### Added

- **`includes/BlockRenderer.php`**: PHP render for the wrapper (`get_block_wrapper_attributes()`), `loading`, and custom iframe attributes (parity with the former `save.js` logic).
- **Block deprecation**: The previous static `save.js` output is kept as a deprecated block definition so existing posts with serialized HTML remain valid in the editor.

### Developer

- **Composer autoload**: PSR-4 `Blockparty\Iframe\` → `includes/`.
- **PHPCS**: Enforce short array syntax (`[]`) via `Generic.Arrays.DisallowLongArraySyntax`; fix exclusion of `Universal.Arrays.DisallowShortArraySyntax` from WordPress-Core.
- **Composer**: `composer.lock` ignored in git; dev dependency pins refreshed (`dealerdirect/phpcodesniffer-composer-installer`, `wp-coding-standards/wpcs`).

## [1.1.2] - 2026-04-21

### Fixed
Expand Down Expand Up @@ -141,6 +159,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

---

[1.2.0]: https://github.com/BeAPI/blockparty-iframe/releases/tag/1.2.0
[1.1.2]: https://github.com/BeAPI/blockparty-iframe/releases/tag/1.1.2
[1.1.1]: https://github.com/BeAPI/blockparty-iframe/releases/tag/1.1.1
[1.1.0]: https://github.com/BeAPI/blockparty-iframe/releases/tag/1.1.0
Expand Down
87 changes: 27 additions & 60 deletions blockparty-iframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
/**
* Plugin Name: Blockparty Iframe
* Description: Add a block to display an embedded frame in the WordPress editor.
* Version: 1.1.2
* Version: 1.2.0
* Requires at least: 6.7
* Requires PHP: 8.1
* Author: Be API Technical team
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: blockparty-iframe
*
* @package CreateBlock
* @package Blockparty\Iframe
*/

namespace Blockparty\Iframe;
Expand All @@ -19,70 +19,37 @@
exit; // Exit if accessed directly.
}

define( 'BLOCKPARTY_IFRAME_VERSION', '1.1.2' );
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
include_once __DIR__ . '/vendor/autoload.php';
}

define( 'BLOCKPARTY_IFRAME_VERSION', '1.2.0' );
define( 'BLOCKPARTY_IFRAME_URL', plugin_dir_url( __FILE__ ) );
define( 'BLOCKPARTY_IFRAME_DIR', plugin_dir_path( __FILE__ ) );
define( 'BLOCKPARTY_IFRAME_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );

// Require vendor
if ( file_exists( BLOCKPARTY_IFRAME_DIR . '/vendor/autoload.php' ) ) {
require BLOCKPARTY_IFRAME_DIR . '/vendor/autoload.php';
}

/**
* Registers the block using a `blocks-manifest.php` file, which improves the performance of block type registration.
* Behind the scenes, it also registers all assets so they can be enqueued
* through the block editor in the corresponding context.
*
* @see https://make.wordpress.org/core/2025/03/13/more-efficient-block-type-registration-in-6-8/
* @see https://make.wordpress.org/core/2024/10/17/new-block-type-registration-apis-to-improve-performance-in-wordpress-6-7/
* Bootstrap the plugin.
*/
function init() {
/**
* Registers the block(s) metadata from the `blocks-manifest.php` and registers the block type(s)
* based on the registered block metadata.
* Added in WordPress 6.8 to simplify the block metadata registration process added in WordPress 6.7.
*
* @see https://make.wordpress.org/core/2025/03/13/more-efficient-block-type-registration-in-6-8/
*/
if ( function_exists( 'wp_register_block_types_from_metadata_collection' ) ) {
wp_register_block_types_from_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' );

init_i18n();
return;
}

/**
* Registers the block(s) metadata from the `blocks-manifest.php` file.
* Added to WordPress 6.7 to improve the performance of block type registration.
*
* @see https://make.wordpress.org/core/2024/10/17/new-block-type-registration-apis-to-improve-performance-in-wordpress-6-7/
*/
if ( function_exists( 'wp_register_block_metadata_collection' ) ) {
wp_register_block_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' );
}
/**
* Registers the block type(s) in the `blocks-manifest.php` file.
*
* @see https://developer.wordpress.org/reference/functions/register_block_type/
*/
$manifest_data = require __DIR__ . '/build/blocks-manifest.php';
foreach ( array_keys( $manifest_data ) as $block_type ) {
register_block_type( __DIR__ . "/build/{$block_type}" );
}

init_i18n();
load_plugin_textdomain(
'blockparty-iframe',
false,
dirname( BLOCKPARTY_IFRAME_PLUGIN_BASENAME ) . '/languages'
);

register_block_type(
BLOCKPARTY_IFRAME_DIR . 'build/blockparty-iframe',
[
'render_callback' => [ BlockRenderer::class, 'render' ],
]
);

wp_set_script_translations(
'blockparty-iframe-editor-script',
'blockparty-iframe',
BLOCKPARTY_IFRAME_DIR . 'languages'
);
}

add_action( 'init', __NAMESPACE__ . '\\init' );

/**
* Load the plugin translations.
*/
function init_i18n() {
// Load available translations.
load_plugin_textdomain( 'blockparty-iframe', false, dirname( BLOCKPARTY_IFRAME_PLUGIN_BASENAME ) . '/languages' );

// Load translations for JS
wp_set_script_translations( 'blockparty-iframe-editor-script', 'blockparty-iframe', BLOCKPARTY_IFRAME_DIR . '/languages' );
}
add_action( 'init', __NAMESPACE__ . '\\init', 0 );
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,20 @@
"composer/installers": "^1.0 || ^2.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
"dealerdirect/phpcodesniffer-composer-installer": "1.2.1",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpcompatibility/php-compatibility": "^9.3",
"phpro/grumphp-shim": "^1.5",
"roave/security-advisories": "dev-latest",
"roots/wordpress-no-content": "^6.0",
"squizlabs/php_codesniffer": "^3.7",
"wp-cli/wp-cli": "^2.6",
"wp-coding-standards/wpcs": "^3.0"
"wp-coding-standards/wpcs": "3.3.0"
},
"autoload": {
"psr-4": {
"Blockparty\\Iframe\\": "includes/"
}
},
"autoload-dev": {},
"scripts": {
Expand Down
Loading
Loading