From 621d558a7af8358b4fdc94ffaca1f7562db66987 Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Mon, 5 Jul 2021 17:34:42 +0300 Subject: [PATCH] [Block Library - Query Loop]: Set default block variations not to inherit from global query (#33163) --- .../block-library/src/query/variations.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/block-library/src/query/variations.js b/packages/block-library/src/query/variations.js index d5790da2048105..ddcd522298f9d3 100644 --- a/packages/block-library/src/query/variations.js +++ b/packages/block-library/src/query/variations.js @@ -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', @@ -44,6 +62,7 @@ const variations = [ name: 'title-date', title: __( 'Title & Date' ), icon: titleDate, + attributes: { ...QUERY_DEFAULT_ATTRIBUTES }, innerBlocks: [ [ 'core/post-template', @@ -57,6 +76,7 @@ const variations = [ name: 'title-excerpt', title: __( 'Title & Excerpt' ), icon: titleExcerpt, + attributes: { ...QUERY_DEFAULT_ATTRIBUTES }, innerBlocks: [ [ 'core/post-template', @@ -70,6 +90,7 @@ const variations = [ name: 'title-date-excerpt', title: __( 'Title, Date, & Excerpt' ), icon: titleDateExcerpt, + attributes: { ...QUERY_DEFAULT_ATTRIBUTES }, innerBlocks: [ [ 'core/post-template', @@ -87,6 +108,7 @@ const variations = [ name: 'image-date-title', title: __( 'Image, Date, & Title' ), icon: imageDateTitle, + attributes: { ...QUERY_DEFAULT_ATTRIBUTES }, innerBlocks: [ [ 'core/post-template',