Skip to content

Commit

Permalink
Add a apply filters to allowed blocks to enable extending
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaz committed Apr 12, 2021
1 parent bbd3333 commit 81d4e3e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/block-library/src/social-links/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
ToolbarItem,
ToolbarGroup,
} from '@wordpress/components';
import { applyFilters } from '@wordpress/hooks';
import { __ } from '@wordpress/i18n';
import { check } from '@wordpress/icons';

Expand Down Expand Up @@ -91,9 +92,15 @@ export function SocialLinksEdit( props ) {
[ `items-justified-${ itemsJustification }` ]: itemsJustification,
} );

// Filter to allow additional social link blocks
const FilteredAllowedBlocks = applyFilters(
'editor.SocialLinks.allowedBlocks',
ALLOWED_BLOCKS
);

const blockProps = useBlockProps( { className } );
const innerBlocksProps = useInnerBlocksProps( blockProps, {
allowedBlocks: ALLOWED_BLOCKS,
allowedBlocks: FilteredAllowedBlocks,
orientation: 'horizontal',
placeholder: SocialPlaceholder,
templateLock: false,
Expand Down

0 comments on commit 81d4e3e

Please sign in to comment.