Changeset 12578 for trunk/src/bp-core/classes/class-bp-component.php
- Timestamp:
- 03/25/2020 07:31:07 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/classes/class-bp-component.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-component.php
r12547 r12578 467 467 } 468 468 469 // Register BP Blocks. 470 if ( bp_rest_api_is_available() ) { 471 add_action( 'bp_blocks_init', array( $this, 'blocks_init' ), 10 ); 472 } 473 469 474 /** 470 475 * Fires at the end of the setup_actions method inside BP_Component. … … 907 912 do_action( 'bp_' . $this->id . '_rest_api_init' ); 908 913 } 914 915 /** 916 * Register the BP Blocks. 917 * 918 * @since 6.0.0 919 * 920 * @param array $blocks The list of BP Blocks to register. 921 */ 922 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 ); 934 935 foreach ( $blocks as $block ) { 936 bp_register_block( $block ); 937 } 938 } 939 940 /** 941 * Fires in the blocks_init method inside BP_Component. 942 * 943 * This is a dynamic hook that is based on the component string ID. 944 * 945 * @since 6.0.0 946 */ 947 do_action( 'bp_' . $this->id . '_blocks_init' ); 948 } 909 949 } 910 950 endif; // BP_Component.
Note: See TracChangeset
for help on using the changeset viewer.