JetEngine
Crocoblock'un JetEngine eklentisindeki verilerle etkileşim kurmak için queries örnekleri.
Tam API için (root fields, JetEngineCCTEntry tipi, filter/pagination/sort, field casts), bkz. JetEngine CCT uzantı referansı.
CCT girişlerini listele
Slug'ını sağlayarak bir CCT'nin tüm girişlerini sorgula. Giriş özelliklerini ve CCT alan değerlerini fieldValues veya fieldValue(slug:) aracılığıyla talep edebilirsiniz.
query JetEngineCCTEntries($cctSlug: String!) {
jetengineCCTEntryCount(cctSlug: $cctSlug)
jetengineCCTEntries(cctSlug: $cctSlug) {
id
cctSlug
status
authorID
author {
id
name
}
singleCustomPostID
singleCustomPost {
id
title
customPostType
}
createdDate
createdDateStr
modifiedDate
modifiedDateStr
fieldValues
label_text: fieldValue(slug: "label_text")
textarea: fieldValue(slug: "textarea")
number: fieldValue(slug: "number")
switcher: fieldValue(slug: "switcher")
gallery: fieldValue(slug: "gallery")
}
}Tek CCT girişi
CCT slug'ı ve girişin sayısal ID'si aracılığıyla tek bir CCT girişini getir.
query JetEngineCCTEntry($cctSlug: String!, $id: ID!) {
jetengineCCTEntry(cctSlug: $cctSlug, by: { id: $id }) {
id
uniqueID
cctSlug
status
authorID
author {
id
name
}
singleCustomPostID
singleCustomPost {
id
title
customPostType
}
createdDate
createdDateStr
modifiedDate
modifiedDateStr
fieldValues
label_text: fieldValue(slug: "label_text")
textarea: fieldValue(slug: "textarea")
repeater: fieldValue(slug: "repeater")
}
}Giriş alanları ve tarihler
Her giriş, örtük alanları (id, authorID, singleCustomPostID, tarihler, vb.) ve CCT alan değerlerini ortaya çıkarır. Biçimlendirilmiş tarih dizeleri için isteğe bağlı format ile createdDateStr / modifiedDateStr kullanın.
query JetEngineCCTEntryFields {
jetengineCCTEntry(cctSlug: "sample_cct", by: { id: 1 }) {
id
uniqueID
cctSlug
status
singleCustomPostID
singleCustomPost {
id
title
customPostType
}
authorID
author {
id
name
}
createdDate
createdDateStr
formattedCreatedDateStr: createdDateStr(format: "d/m/Y")
modifiedDate
modifiedDateStr
formattedModifiedDateStr: modifiedDateStr(format: "d/m/Y")
fieldValues
label_text: fieldValue(slug: "label_text")
number: fieldValue(slug: "number")
}
}CCT girişlerini filtrele
Liste ve sayım sorguları bir filter argümanı kabul eder: ids veya search (alan, değer, operatör) ile filtreleme yapın. Operatörler EQUALS (varsayılan) ve LIKE içerir.
query JetEngineCCTEntriesWithFilter {
# ID'lere göre filtrele
countByIds: jetengineCCTEntryCount(cctSlug: "sample_cct", filter: {
ids: [1, 3]
})
entriesByIds: jetengineCCTEntries(cctSlug: "sample_cct", filter: {
ids: [1, 3]
}) {
id
}
# Alana göre filtrele (EQUALS)
entriesByAuthor: jetengineCCTEntries(cctSlug: "sample_cct", filter: {
search: [{ field: "cct_author_id", value: 1, operator: EQUALS }]
}) {
id
authorID
}
entriesByLabel: jetengineCCTEntries(cctSlug: "sample_cct", filter: {
search: [{ field: "label_text", value: "Some label" }]
}) {
id
label_text: fieldValue(slug: "label_text")
}
# Alana göre filtrele (LIKE)
entriesByTextareaLike: jetengineCCTEntries(cctSlug: "sample_cct", filter: {
search: [{ field: "textarea", value: "description", operator: LIKE }]
}) {
id
textarea: fieldValue(slug: "textarea")
}
# ids + search birleştir
entriesByIdsAndSearch: jetengineCCTEntries(cctSlug: "sample_cct", filter: {
ids: [1, 4],
search: [{ field: "textarea", value: "description", operator: LIKE }]
}) {
id
textarea: fieldValue(slug: "textarea")
}
}Sayfalama ve sıralama
Liste sorguları pagination: { limit, offset } ve sort: { by, order } kabul eder. _ID, cct_created, cct_modified gibi yerleşik anahtarlarla veya herhangi bir CCT alan slug'ıyla sırala.
query JetEngineCCTEntriesWithPagination {
entriesWithLimit: jetengineCCTEntries(cctSlug: "sample_cct", pagination: { limit: 2 }) {
id
createdDate
textarea: fieldValue(slug: "textarea")
}
entriesPage2: jetengineCCTEntries(cctSlug: "sample_cct", pagination: { limit: 1, offset: 1 }) {
id
createdDate
textarea: fieldValue(slug: "textarea")
}
entriesSortByCreatedDesc: jetengineCCTEntries(cctSlug: "sample_cct", sort: { by: "cct_created", order: DESC }) {
id
createdDate
textarea: fieldValue(slug: "textarea")
}
entriesSortByIdAsc: jetengineCCTEntries(cctSlug: "sample_cct", sort: { by: "_ID", order: ASC }) {
id
textarea: fieldValue(slug: "textarea")
}
}Sayfalama ile filtrele
Liste sorgularında filter, pagination ve sort'u birleştir; sayım yalnızca filter kabul eder.
query JetEngineCCTEntriesFilterAndPagination {
jetengineCCTEntryCount(
cctSlug: "sample_cct"
filter: { search: [{ field: "textarea", value: "description", operator: LIKE }] }
)
jetengineCCTEntries(
cctSlug: "sample_cct"
filter: { search: [{ field: "textarea", value: "description", operator: LIKE }] }
pagination: { limit: 10, offset: 0 }
sort: { by: "cct_created", order: DESC }
) {
id
textarea: fieldValue(slug: "textarea")
}
}