Skip to content

Commit

Permalink
Block patterns categories follow-up (#22410)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 18, 2020
1 parent ff8ef0b commit 4fd5ba0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions lib/client-assets.php
Expand Up @@ -709,11 +709,11 @@ function gutenberg_extend_settings_custom_units( $settings ) {
* Register default pattern categories if not registered in Core already.
*/
if ( class_exists( 'WP_Block_Pattern_Categories_Registry' ) ) {
register_block_pattern_category( 'text', array( 'label' => __( 'Text', 'gutenberg' ) ) );
register_block_pattern_category( 'hero', array( 'label' => __( 'Hero', 'gutenberg' ) ) );
register_block_pattern_category( 'columns', array( 'label' => __( 'Columns', 'gutenberg' ) ) );
register_block_pattern_category( 'buttons', array( 'label' => __( 'Buttons', 'gutenberg' ) ) );
register_block_pattern_category( 'gallery', array( 'label' => __( 'Gallery', 'gutenberg' ) ) );
register_block_pattern_category( 'features', array( 'label' => __( 'Features', 'gutenberg' ) ) );
register_block_pattern_category( 'testimonials', array( 'label' => __( 'Testimonials', 'gutenberg' ) ) );
register_block_pattern_category( 'text', array( 'label' => _x( 'Text', 'Block pattern category', 'gutenberg' ) ) );
register_block_pattern_category( 'hero', array( 'label' => _x( 'Hero', 'Block pattern category', 'gutenberg' ) ) );
register_block_pattern_category( 'columns', array( 'label' => _x( 'Columns', 'Block pattern category', 'gutenberg' ) ) );
register_block_pattern_category( 'buttons', array( 'label' => _x( 'Buttons', 'Block pattern category', 'gutenberg' ) ) );
register_block_pattern_category( 'gallery', array( 'label' => _x( 'Gallery', 'Block pattern category', 'gutenberg' ) ) );
register_block_pattern_category( 'features', array( 'label' => _x( 'Features', 'Block pattern category', 'gutenberg' ) ) );
register_block_pattern_category( 'testimonials', array( 'label' => _x( 'Testimonials', 'Block pattern category', 'gutenberg' ) ) );
}
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { map } from 'lodash';
import { map, fromPairs } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -128,7 +128,7 @@ function BlockPatternsPerCategories( { onInsert } ) {
if ( ! pattern.categories || ! pattern.categories.length ) {
return Infinity;
}
const indexedCategories = Object.fromEntries(
const indexedCategories = fromPairs(
categories.map( ( { name }, index ) => [ name, index ] )
);
return Math.min(
Expand Down

0 comments on commit 4fd5ba0

Please sign in to comment.