-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change labels + assign icons for categories and tags
- Loading branch information
1 parent
f245e83
commit 62d741c
Showing
6 changed files
with
47 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { postCategories, postTerms } from '@wordpress/icons'; | ||
|
||
const variationIconMap = { | ||
category: postCategories, | ||
post_tag: postTerms, | ||
}; | ||
|
||
// We add `icons` to categories and tags. The remaining ones use | ||
// the block's default icon. | ||
export default function enhanceVariations( settings, name ) { | ||
if ( name !== 'core/post-terms' ) { | ||
return settings; | ||
} | ||
const variations = settings.variations.map( ( variation ) => ( { | ||
...variation, | ||
...( variationIconMap[ variation.name ] && { | ||
icon: variationIconMap[ variation.name ], | ||
} ), | ||
} ) ); | ||
return { | ||
...settings, | ||
variations, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters