From c821e44c89e01b1c45350f577c55fe49d554dbd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 28 May 2024 16:59:57 +0200 Subject: [PATCH] Add isCustom field & filter --- .../src/components/page-templates/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/edit-site/src/components/page-templates/index.js b/packages/edit-site/src/components/page-templates/index.js index 2c48e163f7373c..49e454b50ae923 100644 --- a/packages/edit-site/src/components/page-templates/index.js +++ b/packages/edit-site/src/components/page-templates/index.js @@ -36,6 +36,7 @@ import { useAddedBy } from './hooks'; import { TEMPLATE_POST_TYPE, OPERATOR_IS_ANY, + OPERATOR_IS, LAYOUT_GRID, LAYOUT_TABLE, LAYOUT_LIST, @@ -62,6 +63,7 @@ const defaultConfigPerViewType = { mediaField: 'preview', primaryField: 'title', columnFields: [ 'description' ], + badgeFields: [ 'isCustom' ], }, [ LAYOUT_LIST ]: { primaryField: 'title', @@ -339,6 +341,20 @@ export default function PageTemplates() { operators: [ OPERATOR_IS_ANY ], }, }, + { + header: __( 'Type' ), + id: 'isCustom', + getValue: ( { item } ) => item.is_custom, + render: ( { item } ) => + item.is_custom ? 'Custom' : undefined, + elements: [ + { value: true, label: 'Custom' }, + { value: false, label: 'Default' }, + ], + filterBy: { + operators: [ OPERATOR_IS ], + }, + }, ], [ authors, view.type ] );