Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Block Library - Query Loop]: Set default block variations not to inherit from global query #33163

Merged
merged 1 commit into from
Jul 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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