diff --git a/projects/plugins/jetpack/changelog/update-subscriber-login-allow-in-nav b/projects/plugins/jetpack/changelog/update-subscriber-login-allow-in-nav new file mode 100644 index 0000000000000..a0e6e9be90ea1 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-subscriber-login-allow-in-nav @@ -0,0 +1,4 @@ +Significance: minor +Type: other + +Subscriber Login: Allow to add it to the Navigation block diff --git a/projects/plugins/jetpack/extensions/blocks/subscriber-login/editor.js b/projects/plugins/jetpack/extensions/blocks/subscriber-login/editor.js index b7cef864db47d..d69f1e3838038 100644 --- a/projects/plugins/jetpack/extensions/blocks/subscriber-login/editor.js +++ b/projects/plugins/jetpack/extensions/blocks/subscriber-login/editor.js @@ -1,4 +1,5 @@ import { createBlock } from '@wordpress/blocks'; +import { addFilter } from '@wordpress/hooks'; import { registerJetpackBlockFromMetadata } from '../../shared/register-jetpack-block'; import metadata from './block.json'; import edit from './edit'; @@ -26,3 +27,14 @@ registerJetpackBlockFromMetadata( metadata, { ], }, } ); + +addFilter( 'blocks.registerBlockType', 'jetpack-subscriber-login-nav-item', ( settings, name ) => { + if ( name === 'core/navigation' ) { + return { + ...settings, + allowedBlocks: [ ...( settings.allowedBlocks ?? [] ), 'jetpack/subscriber-login' ], + }; + } + + return settings; +} );