Hooks and filters
Blocks
ugly_blocks_off
Filter. The names of the blocks (their folder) that are turned off. They are not registered: the editor does not offer them and the site shows nothing in their place. Files and fields stay.
add_filter( 'ugly_blocks_off', fn ( $off ) => array( ...$off, 'hero', 'faq' ) );ugly_layouts_off
Filter. Layouts of a flexible content to hide from the "Add" menu, as 'group_key.field_name' => array( 'layout', ... ).
add_filter( 'ugly_layouts_off', function ( $off ) {
$off['group_page.blocks'] = array( 'hero', 'faq' );
return $off;
} );ugly_register_block_args
Filter. The arguments a block is registered with. Receives the arguments and the name of the block (the folder, without ugly/).
add_filter( 'ugly_register_block_args', function ( array $args, string $name ) {
if ( 'hero' === $name ) {
$args['category'] = 'design';
}
return $args;
}, 10, 2 );ugly_block_template
Filter. The render file of a block. Receives the file name and the block name.
add_filter( 'ugly_block_template', function ( string $file, string $name ) {
return 'hero' === $name ? 'render-hero.php' : $file;
}, 10, 2 );Did this article answer your question?
Thank you. It helps us make the documentation better. Need more help?