BP_Component::blocks_init( array $blocks = array() )

Register the BP Blocks.


Parameters Parameters

$blocks

(array) (Optional) The list of BP Blocks to register.

Default value: array()


Source Source

File: bp-core/classes/class-bp-component.php

	public function blocks_init( $blocks = array() ) {
		if ( is_array( $blocks ) && $blocks ) {
			/**
			 * Filter here to disable all or some BP Blocks for a component.
			 *
			 * This is a dynamic hook that is based on the component string ID.
			 *
			 * @since 6.0.0
			 *
			 * @param array $blocks The list of BP Blocks for the component.
			 */
			$blocks = (array) apply_filters( 'bp_' . $this->id . '_register_blocks', $blocks );

			foreach ( $blocks as $block ) {
				bp_register_block( $block );
			}
		}

		/**
		 * Fires in the blocks_init method inside BP_Component.
		 *
		 * This is a dynamic hook that is based on the component string ID.
		 *
		 * @since 6.0.0
		 */
		do_action( 'bp_' . $this->id . '_blocks_init' );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.