Skip Navigation

[Resolved] Add the Toolset View block to 'allowed_block_types_all' Hook

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by Paul Marconi 1 year, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#2420077
toolset-view-block.PNG

Hi there,

I am using this wordpress hook 'allowed_block_types_all' to allow certain block types in the editor .
I want to disable most of the wordpress & Toolset built-in blocks and add in my custom wp blocks.
I want to only keep the toolset view block (screenshot attached), what is the format to add/keep the toolset view block to my function?

I know for built-in core blocks, it's using this format:
'core/paragraph'
'core/heading'

For my custom wp blocks, I'm using ACF pro plugin, so the format is like below:
'acf/sp-single-button'

For toolset, what is the format?

below is my code to allow certain blocks:

add_filter( 'allowed_block_types_all', 'sp_allowed_block_types', 10, 2 );
function sp_allowed_block_types( $allowed_blocks ) {
return array(
'core/paragraph',
'core/block',
'acf/classic-wysiwyg',
'acf/custom-heading',
'acf/sp-multi-buttons',
'acf/sp-row',
'acf/sp-column',
);
}

Thank you!

#2420459

Hello,

Please try 'toolset-views/view-editor', for example:

add_filter( 'allowed_block_types_all', 'sp_allowed_block_types', 10, 2 );
function sp_allowed_block_types( $allowed_blocks ) {
	return array(
		'toolset-views/view-editor',
	);
}
#2420869

Thank you Luo! I will give that a try!
If I want to include more of the toolset block to the 'allowed_block_types_all' hook, how can we find the names for each of the toolset blocks?

Thanks again!

#2421289

There isn't any existed document for it, Toolset Blocks is also using WordPress built-in function register_block_type() to create new Blocks type, so you can search it in Toolset Blocks plugin file using keyword: register_block_type

More help:
https://developer.wordpress.org/reference/functions/register_block_type/

#2421709

My issue is resolved now. Thank you Luo!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.