Skip to content

Conversation

@jasonbahl
Copy link
Collaborator

What does this implement/fix? Explain your changes.

This adds WPGraphQL for ACF to the extensions page registry.

CleanShot 2025-01-16 at 11 53 11

Smoke Tests

I've verified that basic functionality of the WPGraphQL for ACF plugin works.

With the following environment:

  • WordPress 6.7.1
  • PHP: 8.2.23
  • WPGraphQL v1.29.3
  • WPGraphQL for ACF v2.4.1
  • ACF PRO v6.3.11

I imported the following .json file: https://github.com/wp-graphql/wpgraphql-acf/blob/develop/tests/_data/tests-acf-pro-kitchen-sink.json

After importing I modified the ACF Field Group settings to assign the group to post_type = page, so that any page would have these fields.

I was able to create a Page with many ACF Fields:

CleanShot 2025-01-16 at 12 00 57

Then I was able to query the fields using GraphQL:

CleanShot 2025-01-16 at 12 06 32

Here's the full query I used:

query AcfProKitchenSink {
  page( id:21 idType:DATABASE_ID) {
    id
    databaseId
    title
    content
    acfProKitchenSink {
      ...ACFProKitchenSink
    }
  }
}

fragment ACFProKitchenSink on AcfProKitchenSink {
  gallery {
    ...AcfGallery
  }
  repeater {
    text
    gallery {
      ...AcfGallery
    }
  }
  flexibleContent {
    ...FlexibleContentLayout
  }
}

fragment AcfGallery on AcfMediaItemConnection {
  nodes {
    ...MediaItem
  }
}

fragment MediaItem on MediaItem {
  sourceUrl
  id
  altText
}

fragment FlexibleContentLayout on AcfProKitchenSinkFlexibleContent_Layout {
  ...on AcfProKitchenSinkFlexibleContentLayoutWithTextFieldLayout {
    textField
  }
  ...on AcfProKitchenSinkFlexibleContentLayoutWithGalleryLayout {
    gallery {
      ...AcfGallery
    }
  }
  ...on AcfProKitchenSinkFlexibleContentLayoutWithRepeaterLayout {
    repeater {
      text
    }
  }
}

and the payload I received:

{
  "data": {
    "page": {
      "id": "cG9zdDoyMQ==",
      "databaseId": 21,
      "title": "ACF Test Page",
      "content": "\n<p>This is a test page with ACF PRO fields</p>\n",
      "acfProKitchenSink": {
        "gallery": {
          "nodes": [
            {
              "sourceUrl": "http://acf.local/wp-content/uploads/2025/01/favicon-32x32-1.png",
              "id": "cG9zdDoyMw==",
              "altText": ""
            },
            {
              "sourceUrl": "http://acf.local/wp-content/uploads/2025/01/logo-wpgraphql.png",
              "id": "cG9zdDoyNA==",
              "altText": ""
            }
          ]
        },
        "repeater": [
          {
            "text": "Text Value",
            "gallery": {
              "nodes": [
                {
                  "sourceUrl": "http://acf.local/wp-content/uploads/2025/01/logo-wpgraphql.png",
                  "id": "cG9zdDoyNA==",
                  "altText": ""
                },
                {
                  "sourceUrl": "http://acf.local/wp-content/uploads/2025/01/favicon-32x32-1.png",
                  "id": "cG9zdDoyMw==",
                  "altText": ""
                }
              ]
            }
          }
        ],
        "flexibleContent": [
          {
            "textField": "Text Field Value"
          },
          {
            "gallery": {
              "nodes": [
                {
                  "sourceUrl": "http://acf.local/wp-content/uploads/2025/01/logo-wpgraphql.png",
                  "id": "cG9zdDoyNA==",
                  "altText": ""
                },
                {
                  "sourceUrl": "http://acf.local/wp-content/uploads/2025/01/favicon-32x32-1.png",
                  "id": "cG9zdDoyMw==",
                  "altText": ""
                }
              ]
            }
          },
          {
            "repeater": [
              {
                "text": "Text Value 1"
              },
              {
                "text": "Text Value 2"
              }
            ]
          }
        ]
      }
    }
  }
}

Conclusion

The plugin largely works as intended, provides documentation and offers support via Github and Discord.

Copy link

@qlty-cloud-legacy qlty-cloud-legacy bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 10731 lines exceeds the maximum allowed for the inline comments feature.

@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit 5726cc0 and detected 11 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 9
Duplication 2

View more on Code Climate.

@jasonbahl jasonbahl changed the base branch from develop to feat/3049-extensions-page-fix January 16, 2025 19:08
@jasonbahl jasonbahl merged commit 74b52c7 into wp-graphql:feat/3049-extensions-page-fix Jan 16, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant