From 9a7c73141f210925edee1b9a1941c56a5d8d61e6 Mon Sep 17 00:00:00 2001 From: kennethormandy Date: Tue, 29 May 2018 23:06:01 -0700 Subject: [PATCH 1/4] Adds initial support for Gravity Forms --- packages/gatsby-source-wordpress/src/fetch.js | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/packages/gatsby-source-wordpress/src/fetch.js b/packages/gatsby-source-wordpress/src/fetch.js index daef071fdda51..c90eca97c3780 100644 --- a/packages/gatsby-source-wordpress/src/fetch.js +++ b/packages/gatsby-source-wordpress/src/fetch.js @@ -248,6 +248,37 @@ async function fetchData({ } } } + // Gravity Forms + if (type == `wordpress__gf_forms`) { + for (let key in routeResponse) { + for (let formKey in routeResponse[key]) { + let form = routeResponse[key][formKey] + if (form && form.id && form.title) { + // Ex. /gf/v2/forms/12 + let formUrl = `${url}/${form.id}` + let fetchedData = await fetchData({ + route: { url: formUrl, type: `${type}_items` }, + _verbose, + _perPage, + _hostingWPCOM, + _auth, + _accessToken, + }) + entities = entities.concat(fetchedData) + } + } + } + if (_hostingWPCOM) { + // TODO : Need to test that out with Gravity Forms on Wordpress.com hosted site. Need a premium account on wp.com to install extensions. See also ACF options page. + if (_verbose) + console.log( + colorized.out( + `Gravity Forms untested under wordpress.com hosting. Please let me know if it works.`, + colorized.color.Effect.Blink + ) + ) + } + } // TODO : Get the number of created nodes using the nodes in state. let length if (routeResponse && Array.isArray(routeResponse)) { From 830da2ff03729acaa2267c7cec4110ffd5aeed61 Mon Sep 17 00:00:00 2001 From: kennethormandy Date: Tue, 29 May 2018 23:44:24 -0700 Subject: [PATCH 2/4] =?UTF-8?q?Removes=20=E2=80=9CItems=E2=80=9D=20from=20?= =?UTF-8?q?Gravity=20Froms=20GraphQL=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gatsby-source-wordpress/src/fetch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gatsby-source-wordpress/src/fetch.js b/packages/gatsby-source-wordpress/src/fetch.js index c90eca97c3780..f1077499026a8 100644 --- a/packages/gatsby-source-wordpress/src/fetch.js +++ b/packages/gatsby-source-wordpress/src/fetch.js @@ -257,7 +257,7 @@ async function fetchData({ // Ex. /gf/v2/forms/12 let formUrl = `${url}/${form.id}` let fetchedData = await fetchData({ - route: { url: formUrl, type: `${type}_items` }, + route: { url: formUrl, type: `${type}` }, _verbose, _perPage, _hostingWPCOM, From 3d5aa11eb027b04ce36f0fbb98821c2032149a3f Mon Sep 17 00:00:00 2001 From: shannonbux Date: Wed, 30 May 2018 19:34:45 -0600 Subject: [PATCH 3/4] Added links to source plugin tutorial and wordpress source plugin tutorial --- www/src/pages/docs/doc-links.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/www/src/pages/docs/doc-links.yaml b/www/src/pages/docs/doc-links.yaml index 0f5c622f17115..2004a3a1e4d00 100644 --- a/www/src/pages/docs/doc-links.yaml +++ b/www/src/pages/docs/doc-links.yaml @@ -66,6 +66,8 @@ link: /docs/api-proxy/ - title: Search Engine Optimization (SEO) link: /docs/seo/ + - title: Source Plugin Tutorial + link: /docs/source-plugin-tutorial/ - title: Using CSS-in-JS Library Glamor link: /docs/glamor/ - title: Using CSS-in-JS Library Styled Components @@ -80,6 +82,8 @@ link: /docs/adding-search/ - title: Working With Images in Gatsby link: /docs/working-with-images/ + - title: Wordpress Source Plugin Tutorial + link: /docs/wordpress-source-plugin-tutorial - title: Creating Dynamically-Rendered Navigation* link: /docs/creating-dynamically-rendered-navigation/ - title: Dropping Images into Static Folders* From c2af7a932e602acd4d2fb9cc9853b57b57bd3521 Mon Sep 17 00:00:00 2001 From: shannonbux Date: Wed, 30 May 2018 19:45:56 -0600 Subject: [PATCH 4/4] Revert "Added links to source plugin tutorial and wordpress source plugin tutorial" This reverts commit 3d5aa11eb027b04ce36f0fbb98821c2032149a3f. --- www/src/pages/docs/doc-links.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/www/src/pages/docs/doc-links.yaml b/www/src/pages/docs/doc-links.yaml index 2004a3a1e4d00..0f5c622f17115 100644 --- a/www/src/pages/docs/doc-links.yaml +++ b/www/src/pages/docs/doc-links.yaml @@ -66,8 +66,6 @@ link: /docs/api-proxy/ - title: Search Engine Optimization (SEO) link: /docs/seo/ - - title: Source Plugin Tutorial - link: /docs/source-plugin-tutorial/ - title: Using CSS-in-JS Library Glamor link: /docs/glamor/ - title: Using CSS-in-JS Library Styled Components @@ -82,8 +80,6 @@ link: /docs/adding-search/ - title: Working With Images in Gatsby link: /docs/working-with-images/ - - title: Wordpress Source Plugin Tutorial - link: /docs/wordpress-source-plugin-tutorial - title: Creating Dynamically-Rendered Navigation* link: /docs/creating-dynamically-rendered-navigation/ - title: Dropping Images into Static Folders*