Skip to content

Commit

Permalink
[Block Library - Query Loop]: Set default block variations not to inh…
Browse files Browse the repository at this point in the history
…erit from global query (#33163)
  • Loading branch information
ntsekouras authored and youknowriad committed Jul 6, 2021
1 parent e593cee commit 621d558
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/block-library/src/query/variations.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@ import {
imageDateTitle,
} from './icons';

const QUERY_DEFAULT_ATTRIBUTES = {
query: {
perPage: 3,
pages: 0,
offset: 0,
postType: 'post',
categoryIds: [],
tagIds: [],
order: 'desc',
orderBy: 'date',
author: '',
search: '',
exclude: [],
sticky: '',
inherit: false,
},
};

const variations = [
{
name: 'posts-list',
Expand Down Expand Up @@ -44,6 +62,7 @@ const variations = [
name: 'title-date',
title: __( 'Title & Date' ),
icon: titleDate,
attributes: { ...QUERY_DEFAULT_ATTRIBUTES },
innerBlocks: [
[
'core/post-template',
Expand All @@ -57,6 +76,7 @@ const variations = [
name: 'title-excerpt',
title: __( 'Title & Excerpt' ),
icon: titleExcerpt,
attributes: { ...QUERY_DEFAULT_ATTRIBUTES },
innerBlocks: [
[
'core/post-template',
Expand All @@ -70,6 +90,7 @@ const variations = [
name: 'title-date-excerpt',
title: __( 'Title, Date, & Excerpt' ),
icon: titleDateExcerpt,
attributes: { ...QUERY_DEFAULT_ATTRIBUTES },
innerBlocks: [
[
'core/post-template',
Expand All @@ -87,6 +108,7 @@ const variations = [
name: 'image-date-title',
title: __( 'Image, Date, & Title' ),
icon: imageDateTitle,
attributes: { ...QUERY_DEFAULT_ATTRIBUTES },
innerBlocks: [
[
'core/post-template',
Expand Down

0 comments on commit 621d558

Please sign in to comment.