From 20d03d71b1eb31de22082e5a8d8f49715837734f Mon Sep 17 00:00:00 2001 From: pkuliga Date: Fri, 2 Feb 2024 10:47:21 +0100 Subject: [PATCH 1/2] allow subscriber login to be added as a nav item --- .../extensions/blocks/subscriber-login/editor.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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; +} ); From b620375e8b50efa82c884d7d9f5404a4ce484c34 Mon Sep 17 00:00:00 2001 From: pkuliga Date: Fri, 2 Feb 2024 10:48:28 +0100 Subject: [PATCH 2/2] changelog --- .../jetpack/changelog/update-subscriber-login-allow-in-nav | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/plugins/jetpack/changelog/update-subscriber-login-allow-in-nav 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