Plugin Directory

Changeset 3360726


Ignore:
Timestamp:
09/12/2025 06:35:18 PM (7 months ago)
Author:
mrboydwp
Message:

Update to version 1.2.3 - Fix block registration namespace warning

Location:
bcodecraft-blocks/trunk
Files:
17 added
3 edited

Legend:

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

    r3360711 r3360726  
    1616
    1717    public function registerBlock() {
    18         // WordPress 6.0+ compatible block registration
    19         // Register block type with proper namespace handling
     18        // WordPress 6.0+ compatible block registration with explicit namespace
    2019        $block_json_path = SNIPPY_BLOCKS_PLUGIN_DIR . 'build';
    2120       
     21        // First check if build version exists (production)
    2222        if (file_exists($block_json_path . '/block.json')) {
    23             // Production: use built block.json
    24             register_block_type($block_json_path, [
     23            register_block_type($block_json_path . '/block.json', [
    2524                'render_callback' => [$this, 'renderBlockCallback'],
    2625            ]);
    27         } else {
    28             // Development: use source block.json 
    29             register_block_type(SNIPPY_BLOCKS_PLUGIN_DIR . 'src', [
     26        }
     27        // Fallback to source version (development) 
     28        else if (file_exists(SNIPPY_BLOCKS_PLUGIN_DIR . 'src/block.json')) {
     29            register_block_type(SNIPPY_BLOCKS_PLUGIN_DIR . 'src/block.json', [
    3030                'render_callback' => [$this, 'renderBlockCallback'],
     31            ]);
     32        }
     33        // Manual registration as fallback (should not happen if files exist)
     34        else {
     35            register_block_type('bccb-blocks/snippet', [
     36                'render_callback' => [$this, 'renderBlockCallback'],
     37                'attributes' => [
     38                    'snippetId' => [
     39                        'type' => 'number',
     40                        'default' => 0
     41                    ],
     42                    'snippetTitle' => [
     43                        'type' => 'string',
     44                        'default' => ''
     45                    ],
     46                    'snippetContent' => [
     47                        'type' => 'string',
     48                        'default' => ''
     49                    ]
     50                ]
    3151            ]);
    3252        }
  • bcodecraft-blocks/trunk/readme.txt

    r3360709 r3360726  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 1.2.2
     8Stable tag: 1.2.3
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • bcodecraft-blocks/trunk/snippy-blocks.php

    r3360709 r3360726  
    33 * Plugin Name: bcodecraft Blocks
    44 * Description: A modern WordPress plugin for managing and reusing content snippets with seamless Block Editor integration.
    5  * Version: 1.2.2
     5 * Version: 1.2.3
    66 * Author: bcodecraft
    77 * License: GPL v2 or later
     
    1717}
    1818
    19 define('SNIPPY_BLOCKS_VERSION', '1.2.2');
     19define('SNIPPY_BLOCKS_VERSION', '1.2.3');
    2020define('SNIPPY_BLOCKS_PLUGIN_FILE', __FILE__);
    2121define('SNIPPY_BLOCKS_PLUGIN_DIR', plugin_dir_path(__FILE__));
Note: See TracChangeset for help on using the changeset viewer.