플러그인 데이터 쿼리Bricks
Bricks
가이드 Working with Bricks 에서 자세한 내용을 확인하세요.
Bricks 플러그인의 데이터를 다루기 위한 Query 예시입니다.
Bricks 데이터 가져오기
이 Query는 게시물에서 Bricks 데이터(_bricks_page_header_2, _bricks_page_content_2, 또는 _bricks_page_footer_2 엔트리의 메타로 저장됨)를 가져오며, DB에 저장된 데이터의 구조를 그대로 유지합니다.
{
post(by: { id: 1 }) {
bricksData
}
}이 Query는 Bricks 데이터를 text라는 이름의 요소만 포함하도록 필터링합니다.
{
post(by: { id: 1 }) {
bricksData(filterBy: { include: ["text"] })
}
}Bricks 데이터 업데이트
이 mutation은 Bricks 데이터 내의 특정 요소를 병합합니다.
mutation {
bricksMergeCustomPostElementDataItem(input: {
customPostID: 1
elements: [
{
id: "ucuzdk",
settings: {
text: "Updated text"
}
}
]
}) {
status
errors {
__typename
...on ErrorPayload {
message
}
}
customPost {
__typename
...on CustomPost {
id
bricksData
}
}
}
}Next