Skip to content

Commit

Permalink
migrate only columns to text and show text at the bottom of cat…
Browse files Browse the repository at this point in the history
…egories list
  • Loading branch information
ntsekouras committed Dec 8, 2022
1 parent eca4486 commit 2cbcc74
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class Gutenberg_REST_Block_Patterns_Controller_6_2 extends Gutenberg_REST_Block_
*/
protected static $categories_migration = array(
'buttons' => 'call-to-action',
'columns' => 'media',
'text' => 'media',
'columns' => 'text',
'query' => 'posts',
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,17 @@ function usePatternsCategories() {
)
)
.sort( ( { name: currentName }, { name: nextName } ) => {
if ( ! [ currentName, nextName ].includes( 'featured' ) ) {
if (
! [ currentName, nextName ].some( ( categoryName ) =>
[ 'featured', 'text' ].includes( categoryName )
)
) {
return 0;
}
return currentName === 'featured' ? -1 : 1;
// Move `featured` category to the top and `text` to the bottom.
return currentName === 'featured' || nextName === 'text'
? -1
: 1;
} );

if (
Expand Down

0 comments on commit 2cbcc74

Please sign in to comment.