Skip to content

Commit

Permalink
Subscriber Login: Allow to add it to the Navigation block (#35410)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkuliga authored and spsiddarthan committed Feb 15, 2024
1 parent 8e25e73 commit f43228b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: other

Subscriber Login: Allow to add it to the Navigation block
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;
} );

0 comments on commit f43228b

Please sign in to comment.