Plugin Directory

Changeset 3360698


Ignore:
Timestamp:
09/12/2025 05:50:19 PM (7 months ago)
Author:
mrboydwp
Message:

Force update class-snippy-blocks-editor.php with block registration fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bcodecraft-blocks/trunk/includes/class-snippy-blocks-editor.php

    r3360672 r3360698  
    1616
    1717    public function registerBlock() {
    18         // WordPress 6.8.2 compatible block registration using block.json
    19         if (file_exists(SNIPPY_BLOCKS_PLUGIN_DIR . 'build/block.json')) {
    20             register_block_type(SNIPPY_BLOCKS_PLUGIN_DIR . 'build/block.json', [
     18        // WordPress 6.0+ compatible block registration
     19        // Register block type with proper namespace handling
     20        $block_json_path = SNIPPY_BLOCKS_PLUGIN_DIR . 'build';
     21       
     22        if (file_exists($block_json_path . '/block.json')) {
     23            // Production: use built block.json
     24            register_block_type($block_json_path, [
    2125                'render_callback' => [$this, 'renderBlockCallback'],
    2226            ]);
    2327        } else {
    24             // Fallback for development
    25             register_block_type(SNIPPY_BLOCKS_PLUGIN_DIR . 'src/block.json', [
     28            // Development: use source block.json 
     29            register_block_type(SNIPPY_BLOCKS_PLUGIN_DIR . 'src', [
    2630                'render_callback' => [$this, 'renderBlockCallback'],
    2731            ]);
Note: See TracChangeset for help on using the changeset viewer.