Item` |
TODO: Example with more renamed elements
Example of updated query
-
+
+| 3.3 | 4.0 |
+
+|
```graphql
{
content {
@@ -196,7 +204,7 @@ Example of updated query
}
}
```
- |
+ |
```graphql
{
content {
@@ -208,7 +216,50 @@ Example of updated query
}
}
```
- |
+ |
+The following query is made for several content types, and the content or location ID is injected before requesting it.
+
+For example, `$criterion='locationId: 2';` |
+|
+```
+{
+ item ($criterion) {
+ ... on FolderContent {
+ name
+ }
+ ... on LandingPageContent {
+ name
+ }
+ ... on ArticleContent {
+ title
+ intro {
+ html5
+ }
+ }
+ }
+}
+```
+ |
+```
+{
+ item ($criterion) {
+ ... on FolderContent {
+ name
+ }
+ ... on LandingPageContent {
+ name
+ }
+ ... on ArticleContent {
+ title
+ intro {
+ html5
+ }
+ }
+ }
+}
+```
+ |
+
### Back office customization
From d6b4326cfd2d28718be9ece10f49c98037d8f6d2 Mon Sep 17 00:00:00 2001
From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com>
Date: Mon, 9 Dec 2024 16:19:37 +0100
Subject: [PATCH 4/9] to_4.0.md: Add few more renamed elements
---
docs/update_and_migration/from_3.3/to_4.0.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/update_and_migration/from_3.3/to_4.0.md b/docs/update_and_migration/from_3.3/to_4.0.md
index ae331e0e49..1ce907a3aa 100644
--- a/docs/update_and_migration/from_3.3/to_4.0.md
+++ b/docs/update_and_migration/from_3.3/to_4.0.md
@@ -219,7 +219,7 @@ Example of updated query
The following query is made for several content types, and the content or location ID is injected before requesting it.
-For example, `$criterion='locationId: 2';` |
+For example, $criterion='locationId: 2';
```
{
From 843d28eb5b22f24b502c8dd64c9d39c3d2b3bb5b Mon Sep 17 00:00:00 2001
From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com>
Date: Mon, 9 Dec 2024 16:20:35 +0100
Subject: [PATCH 5/9] to_4.0.md: Add few more renamed elements
---
docs/update_and_migration/from_3.3/to_4.0.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/docs/update_and_migration/from_3.3/to_4.0.md b/docs/update_and_migration/from_3.3/to_4.0.md
index 1ce907a3aa..6092846e43 100644
--- a/docs/update_and_migration/from_3.3/to_4.0.md
+++ b/docs/update_and_migration/from_3.3/to_4.0.md
@@ -242,14 +242,14 @@ For example, $criterion='locationId: 2'; |
```
{
- item ($criterion) {
- ... on FolderContent {
+ item (locationId: 2) {
+ ... on FolderItem {
name
}
- ... on LandingPageContent {
+ ... on LandingPageItem {
name
}
- ... on ArticleContent {
+ ... on ArticleItem {
title
intro {
html5
From 5b8220df66d59c4d4e45f9b51d7af2f43fbc266e Mon Sep 17 00:00:00 2001
From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com>
Date: Thu, 9 Jan 2025 16:12:48 +0100
Subject: [PATCH 6/9] GraphQL: item() was introduced in 4.x
---
docs/update_and_migration/from_3.3/to_4.0.md | 46 ++------------------
1 file changed, 4 insertions(+), 42 deletions(-)
diff --git a/docs/update_and_migration/from_3.3/to_4.0.md b/docs/update_and_migration/from_3.3/to_4.0.md
index 6092846e43..b5f7704add 100644
--- a/docs/update_and_migration/from_3.3/to_4.0.md
+++ b/docs/update_and_migration/from_3.3/to_4.0.md
@@ -217,50 +217,12 @@ Example of updated query
}
```
|
-The following query is made for several content types, and the content or location ID is injected before requesting it.
-
-For example, $criterion='locationId: 2'; |
-|
-```
-{
- item ($criterion) {
- ... on FolderContent {
- name
- }
- ... on LandingPageContent {
- name
- }
- ... on ArticleContent {
- title
- intro {
- html5
- }
- }
- }
-}
-```
- |
-```
-{
- item (locationId: 2) {
- ... on FolderItem {
- name
- }
- ... on LandingPageItem {
- name
- }
- ... on ArticleItem {
- title
- intro {
- html5
- }
- }
- }
-}
-```
- |
+While revisiting GraphQL queries, you may consider the new feature `item`
+allowing to fetch a content item without knowing its content type.
+For more information, see [Get a content item](graphql_queries.md#get-a-content-item)
+
### Back office customization
The v4 version of [[= product_name =]] is using Bootstrap 5 in the back office. If you were using Bootstrap 4 for styling, you need to update and adjust all custom back office components [following the migration guide from Bootstrap 4](https://getbootstrap.com/docs/5.0/migration/).
From c4132d77e933353b9715d4f65c7ac3cdfb751004 Mon Sep 17 00:00:00 2001
From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com>
Date: Thu, 16 Jan 2025 12:01:13 +0100
Subject: [PATCH 7/9] graphql_queries.md: extend item example with conditional
fields
---
docs/api/graphql/graphql_queries.md | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/docs/api/graphql/graphql_queries.md b/docs/api/graphql/graphql_queries.md
index 20513daa6d..d38629b8dd 100644
--- a/docs/api/graphql/graphql_queries.md
+++ b/docs/api/graphql/graphql_queries.md
@@ -15,7 +15,7 @@ To get a specific content item by its content ID, location ID, or URL alias, use
```
{
content {
- article (contentId: 62) {
+ article(contentId: 62) {
title
author {
name
@@ -52,8 +52,17 @@ The query accepts `locationId`, `remoteId`, and `urlAlias` as arguments.
```
{
- item (locationId: 2) {
+ item(locationId: 2) {
_name
+ ... on FolderItem {
+ name
+ }
+ ... on LandingPageItem {
+ name
+ }
+ ... on ArticleItem {
+ title
+ }
}
}
```
@@ -181,9 +190,9 @@ To get the IDs and names of all Fields in the `article` content type:
{
content {
_types {
- article{
+ article {
_info {
- fieldDefinitions{
+ fieldDefinitions {
id
name
}
@@ -318,8 +327,8 @@ Alternatively, you can query the `children` property of an `item` or `content` o
```
{
- item (locationId: 2) {
- _location{
+ item(locationId: 2) {
+ _location {
children {
edges {
node {
From b35bc3b192e9e94cf69942cad8382ef6cc8b0b49 Mon Sep 17 00:00:00 2001
From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com>
Date: Thu, 16 Jan 2025 14:00:05 +0100
Subject: [PATCH 8/9] Update docs/css/custom.css
---
docs/css/custom.css | 5 -----
1 file changed, 5 deletions(-)
diff --git a/docs/css/custom.css b/docs/css/custom.css
index 437b6cf194..36bf838ac1 100644
--- a/docs/css/custom.css
+++ b/docs/css/custom.css
@@ -396,11 +396,6 @@ figcaption {
font-style: italic;
text-align: center;
}
-
-a.external:not(.card) {
- white-space: nowrap;
-}
-
a.external:not(.card):after {
content: url(../images/open-in-new.svg);
font-style: normal;
From 905c14f9de2e425d49b25cb499b3c0ab77111e58 Mon Sep 17 00:00:00 2001
From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com>
Date: Wed, 29 Jan 2025 13:24:23 +0100
Subject: [PATCH 9/9] (minor) reset/format custom.css
git checkout master -- docs/css/custom.css
---
docs/css/custom.css | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/css/custom.css b/docs/css/custom.css
index 36bf838ac1..0c7e4a214c 100644
--- a/docs/css/custom.css
+++ b/docs/css/custom.css
@@ -396,6 +396,7 @@ figcaption {
font-style: italic;
text-align: center;
}
+
a.external:not(.card):after {
content: url(../images/open-in-new.svg);
font-style: normal;