diff --git src/bp-blogs/classes/class-bp-blogs-component.php src/bp-blogs/classes/class-bp-blogs-component.php
index 9ad5e6d1f..fa4bae095 100644
|
|
class BP_Blogs_Component extends BP_Component { |
379 | 379 | |
380 | 380 | parent::rest_api_init( $controllers ); |
381 | 381 | } |
| 382 | |
| 383 | /** |
| 384 | * Register the BP Blogs Blocks. |
| 385 | * |
| 386 | * @since 9.0.0 |
| 387 | * |
| 388 | * @param array $blocks Optional. See BP_Component::blocks_init() for |
| 389 | * description. |
| 390 | */ |
| 391 | public function blocks_init( $blocks = array() ) { |
| 392 | parent::blocks_init( array() ); |
| 393 | } |
382 | 394 | } |
diff --git src/bp-core/classes/class-bp-block.php src/bp-core/classes/class-bp-block.php
index baf31c837..b361ee5a0 100644
|
|
class BP_Block { |
47 | 47 | * |
48 | 48 | * @since 6.0.0 |
49 | 49 | * |
50 | | * @param array $args The registration arguments for the BP Block. |
| 50 | * @param array $args { |
| 51 | * The registration arguments for the BP Block. Part of the arguments are the ones |
| 52 | * used by `WP_Block_Type`. Below are BP specific arguments. |
| 53 | * |
| 54 | * @type string $name The name of the block (eg: `bp/member`). |
| 55 | * @type string $editor_script_url URL to the JavaScript main file of the BP Block |
| 56 | * to load into the Block Editor. |
| 57 | * @type array $editor_script_deps The list of JavaScript dependency handles for the |
| 58 | * BP Block main file. |
| 59 | * @type string $script_url URL to the JavaScript file to load into the Block |
| 60 | * Editor and on front-end. |
| 61 | * @type array $script_deps The list of JavaScript dependency handles for the |
| 62 | * JavaScript file to load into the Block Editor and |
| 63 | * on front-end. |
| 64 | * @type string $editor_style_url URL to the CSS main file of the BP Block to load |
| 65 | * into the Block Editor. |
| 66 | * @type array $editor_style_deps The list of CSS dependency handles for the |
| 67 | * CSS main file. |
| 68 | * @type string $style_url URL to the CSS file to load into the Block Editor |
| 69 | * and on front-end. |
| 70 | * @type array $style_deps The list of CSS dependency handles for the CSS file |
| 71 | * to load into the Block Editor and on front-end. |
| 72 | * } |
51 | 73 | */ |
52 | 74 | public function __construct( $args ) { |
53 | 75 | if ( ! did_action( 'bp_blocks_init' ) ) { |
diff --git src/bp-core/classes/class-bp-component.php src/bp-core/classes/class-bp-component.php
index ee3dfde6d..23ef1cbc5 100644
|
|
class BP_Component { |
917 | 917 | * |
918 | 918 | * @since 6.0.0 |
919 | 919 | * |
| 920 | * @see `BP_Block->construct()` for a full description of a BP Block arguments. |
| 921 | * |
920 | 922 | * @param array $blocks The list of BP Blocks to register. |
921 | 923 | */ |
922 | 924 | public function blocks_init( $blocks = array() ) { |
923 | | if ( is_array( $blocks ) && $blocks ) { |
924 | | /** |
925 | | * Filter here to disable all or some BP Blocks for a component. |
926 | | * |
927 | | * This is a dynamic hook that is based on the component string ID. |
928 | | * |
929 | | * @since 6.0.0 |
930 | | * |
931 | | * @param array $blocks The list of BP Blocks for the component. |
932 | | */ |
933 | | $blocks = (array) apply_filters( 'bp_' . $this->id . '_register_blocks', $blocks ); |
| 925 | /** |
| 926 | * Filter here to add new BP Blocks, disable some or all BP Blocks for a component. |
| 927 | * |
| 928 | * This is a dynamic hook that is based on the component string ID. |
| 929 | * |
| 930 | * @since 6.0.0 |
| 931 | * |
| 932 | * @param array $blocks The list of BP Blocks for the component. |
| 933 | */ |
| 934 | $blocks = (array) apply_filters( 'bp_' . $this->id . '_register_blocks', $blocks ); |
| 935 | $blocks = array_filter( $blocks ); |
934 | 936 | |
| 937 | if ( $blocks ) { |
935 | 938 | foreach ( $blocks as $block ) { |
936 | 939 | bp_register_block( $block ); |
937 | 940 | } |
diff --git src/bp-core/classes/class-bp-core.php src/bp-core/classes/class-bp-core.php
index ca6fa8b2d..6030eb0e0 100644
|
|
class BP_Core extends BP_Component { |
351 | 351 | |
352 | 352 | parent::register_post_types(); |
353 | 353 | } |
| 354 | |
| 355 | /** |
| 356 | * Init the Core controllers of the BP REST API. |
| 357 | * |
| 358 | * @since 9.0.0 |
| 359 | * |
| 360 | * @param array $controllers Optional. See BP_Component::rest_api_init() for |
| 361 | * description. |
| 362 | */ |
| 363 | public function rest_api_init( $controllers = array() ) { |
| 364 | $controllers = array( |
| 365 | 'BP_REST_Components_Endpoint', |
| 366 | ); |
| 367 | |
| 368 | parent::rest_api_init( $controllers ); |
| 369 | } |
| 370 | |
| 371 | /** |
| 372 | * Register the BP Core Blocks. |
| 373 | * |
| 374 | * @since 9.0.0 |
| 375 | * |
| 376 | * @param array $blocks Optional. See BP_Component::blocks_init() for |
| 377 | * description. |
| 378 | */ |
| 379 | public function blocks_init( $blocks = array() ) { |
| 380 | parent::blocks_init( array() ); |
| 381 | } |
354 | 382 | } |
diff --git src/bp-friends/classes/class-bp-friends-component.php src/bp-friends/classes/class-bp-friends-component.php
index d29f416dd..29594f04a 100644
|
|
class BP_Friends_Component extends BP_Component { |
337 | 337 | public function rest_api_init( $controllers = array() ) { |
338 | 338 | parent::rest_api_init( array( 'BP_REST_Friends_Endpoint' ) ); |
339 | 339 | } |
| 340 | |
| 341 | /** |
| 342 | * Register the BP Friends Blocks. |
| 343 | * |
| 344 | * @since 9.0.0 |
| 345 | * |
| 346 | * @param array $blocks Optional. See BP_Component::blocks_init() for |
| 347 | * description. |
| 348 | */ |
| 349 | public function blocks_init( $blocks = array() ) { |
| 350 | parent::blocks_init( array() ); |
| 351 | } |
340 | 352 | } |
diff --git src/bp-members/classes/class-bp-members-component.php src/bp-members/classes/class-bp-members-component.php
index 6355fbfe6..312a0ceca 100644
|
|
class BP_Members_Component extends BP_Component { |
695 | 695 | * |
696 | 696 | * @since 5.0.0 |
697 | 697 | * @since 6.0.0 Adds the Member Cover and Signup REST endpoints. |
| 698 | * @since 9.0.0 Moves the `BP_REST_Components_Endpoint` controller in `BP_Core` component. |
698 | 699 | * |
699 | 700 | * @param array $controllers Optional. See BP_Component::rest_api_init() for |
700 | 701 | * description. |
701 | 702 | */ |
702 | 703 | public function rest_api_init( $controllers = array() ) { |
703 | 704 | $controllers = array( |
704 | | /** |
705 | | * As the Members component is always loaded, |
706 | | * let's register the Components endpoint here. |
707 | | */ |
708 | | 'BP_REST_Components_Endpoint', |
709 | 705 | 'BP_REST_Members_Endpoint', |
710 | 706 | 'BP_REST_Attachments_Member_Avatar_Endpoint', |
711 | 707 | ); |
diff --git src/bp-messages/classes/class-bp-messages-component.php src/bp-messages/classes/class-bp-messages-component.php
index 1904bd98c..f04c00c50 100644
|
|
class BP_Messages_Component extends BP_Component { |
445 | 445 | public function rest_api_init( $controllers = array() ) { |
446 | 446 | parent::rest_api_init( array( 'BP_REST_Messages_Endpoint' ) ); |
447 | 447 | } |
| 448 | |
| 449 | /** |
| 450 | * Register the BP Messages Blocks. |
| 451 | * |
| 452 | * @since 9.0.0 |
| 453 | * |
| 454 | * @param array $blocks Optional. See BP_Component::blocks_init() for |
| 455 | * description. |
| 456 | */ |
| 457 | public function blocks_init( $blocks = array() ) { |
| 458 | parent::blocks_init( array() ); |
| 459 | } |
448 | 460 | } |
diff --git src/bp-settings/classes/class-bp-settings-component.php src/bp-settings/classes/class-bp-settings-component.php
index e48747f81..383d5cf25 100644
|
|
class BP_Settings_Component extends BP_Component { |
292 | 292 | |
293 | 293 | parent::setup_admin_bar( $wp_admin_nav ); |
294 | 294 | } |
| 295 | |
| 296 | /** |
| 297 | * Register the BP Settings Blocks. |
| 298 | * |
| 299 | * @since 9.0.0 |
| 300 | * |
| 301 | * @param array $blocks Optional. See BP_Component::blocks_init() for |
| 302 | * description. |
| 303 | */ |
| 304 | public function blocks_init( $blocks = array() ) { |
| 305 | parent::blocks_init( array() ); |
| 306 | } |
295 | 307 | } |
diff --git src/bp-xprofile/classes/class-bp-xprofile-component.php src/bp-xprofile/classes/class-bp-xprofile-component.php
index 2976fdf5a..305ebea94 100644
|
|
class BP_XProfile_Component extends BP_Component { |
456 | 456 | 'BP_REST_XProfile_Data_Endpoint', |
457 | 457 | ) ); |
458 | 458 | } |
| 459 | |
| 460 | /** |
| 461 | * Register the BP xProfile Blocks. |
| 462 | * |
| 463 | * @since 9.0.0 |
| 464 | * |
| 465 | * @param array $blocks Optional. See BP_Component::blocks_init() for |
| 466 | * description. |
| 467 | */ |
| 468 | public function blocks_init( $blocks = array() ) { |
| 469 | parent::blocks_init( array() ); |
| 470 | } |
459 | 471 | } |