Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/25/2023 10:17:33 PM (3 years ago)
Author:
imath
Message:

Update all BP Blocks & Modern JS PHP registration code

  • Use the metadata argument of the bp_register_block() function to load all BP Blocks JSON files.
  • Get BP Blocks dependencies using the @wordpress/scripts index.asset.php generated files.
  • Although the BP Blocks category has been replaced by the BP Blocks collection, leave the no more used bp_block_category() function in place in case some third party plugins are using it for their custom blocks.
  • PHPUnit tests: make sure to unregister all BP Blocks when using the BP_UnitTestCase->go_to() method.

See #8842
Fixes #8457
Closes https://github.com/buddypress/buddypress/pull/92

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-core.php

    r13441 r13464  
    453453         *
    454454         * @since 9.0.0
     455         * @since 12.0.0 Use the WP Blocks API v2.
    455456         *
    456457         * @param array $blocks Optional. See BP_Component::blocks_init() for
     
    461462                        array(
    462463                                'bp/login-form' => array(
    463                                         'name'               => 'bp/login-form',
    464                                         'editor_script'      => 'bp-login-form-block',
    465                                         'editor_script_url'  => plugins_url( 'js/blocks/login-form.js', dirname( __FILE__ ) ),
    466                                         'editor_script_deps' => array(
    467                                                 'wp-blocks',
    468                                                 'wp-element',
    469                                                 'wp-components',
    470                                                 'wp-i18n',
    471                                                 'wp-block-editor',
    472                                                 'wp-server-side-render',
    473                                         ),
    474                                         'style'              => 'bp-login-form-block',
    475                                         'style_url'          => plugins_url( 'css/blocks/login-form.css', dirname( __FILE__ ) ),
    476                                         'attributes'         => array(
    477                                                 'title'         => array(
    478                                                         'type'    => 'string',
    479                                                         'default' => '',
    480                                                 ),
    481                                                 'forgotPwdLink' => array(
    482                                                         'type'    => 'boolean',
    483                                                         'default' => false,
    484                                                 ),
    485                                         ),
    486                                         'render_callback'    => 'bp_block_render_login_form_block',
     464                                        'metadata'        => trailingslashit( buddypress()->plugin_dir ) . 'bp-core/blocks/login-form',
     465                                        'render_callback' => 'bp_block_render_login_form_block',
    487466                                ),
    488467                        )
Note: See TracChangeset for help on using the changeset viewer.