From a6181d37c3071cdf1663cfe03ccc2777038a79da Mon Sep 17 00:00:00 2001 From: Chris Hutchinson Date: Thu, 17 Sep 2015 13:00:34 +0100 Subject: [PATCH] Update docs for 1.3.2 --- docs/classes/ACFtoWPAPI.html | 10 ++-- docs/files/acf-to-wp-api.html | 8 +-- docs/files/acf-to-wp-api.php.txt | 50 ++++++++++++++---- docs/graphs/class.html | 2 +- docs/index.html | 8 +-- docs/namespaces/default.html | 8 +-- ...-file_ed4324bfbbef445f3dccc426ada722ee.dat | Bin 96095 -> 97500 bytes docs/reports/deprecated.html | 2 +- docs/reports/errors.html | 4 +- docs/reports/markers.html | 2 +- 10 files changed, 62 insertions(+), 32 deletions(-) diff --git a/docs/classes/ACFtoWPAPI.html b/docs/classes/ACFtoWPAPI.html index d95daeb..5bb8f42 100644 --- a/docs/classes/ACFtoWPAPI.html +++ b/docs/classes/ACFtoWPAPI.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -167,7 +167,7 @@

\ACFtoWPAPI

Description: Puts all ACF fields from posts, pages, custom post types, attachments and taxonomy terms, into the WP-API output under the 'acf' key Author: Chris Hutchinson Author URI: http://www.chrishutchinson.me -Version: 1.3.0 +Version: 1.3.2 Plugin URI: https://wordpress.org/plugins/acf-to-wp-api/

@@ -554,6 +554,7 @@

Tags

since + 1.3.2

Adds support for pages and public custom post types

1.3.0 @@ -950,6 +951,7 @@

Tags

since + 1.3.1

Switched to array() notation (over [] notation) to support PHP < 5.4

1.3.0 @@ -1579,7 +1581,7 @@


Documentation is powered by phpDocumentor and authored - on August 31st, 2015 at 10:10. + on September 17th, 2015 at 11:59.
diff --git a/docs/files/acf-to-wp-api.html b/docs/files/acf-to-wp-api.html index b5b5b69..dd29bed 100644 --- a/docs/files/acf-to-wp-api.html +++ b/docs/files/acf-to-wp-api.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -175,7 +175,7 @@

Classes

Description: Puts all ACF fields from posts, pages, custom post types, attachments and taxonomy terms, into the WP-API output under the 'acf' key Author: Chris Hutchinson Author URI: http://www.chrishutchinson.me -Version: 1.3.0 +Version: 1.3.2 Plugin URI: https://wordpress.org/plugins/acf-to-wp-api/ @@ -247,7 +247,7 @@


Documentation is powered by phpDocumentor and authored - on August 31st, 2015 at 10:10. + on September 17th, 2015 at 11:59.
diff --git a/docs/files/acf-to-wp-api.php.txt b/docs/files/acf-to-wp-api.php.txt index 298e3f7..c5f93c4 100644 --- a/docs/files/acf-to-wp-api.php.txt +++ b/docs/files/acf-to-wp-api.php.txt @@ -4,7 +4,7 @@ * Description: Puts all ACF fields from posts, pages, custom post types, attachments and taxonomy terms, into the WP-API output under the 'acf' key * Author: Chris Hutchinson * Author URI: http://www.chrishutchinson.me - * Version: 1.3.0 + * Version: 1.3.2 * Plugin URI: https://wordpress.org/plugins/acf-to-wp-api/ */ @@ -35,7 +35,7 @@ class ACFtoWPAPI { $this->plugin->name = 'acf-to-wp-api'; $this->plugin->folder = WP_PLUGIN_DIR . '/' . $this->plugin->name; $this->plugin->url = WP_PLUGIN_URL . '/' . str_replace(basename( __FILE__), "", plugin_basename(__FILE__)); - $this->plugin->version = '1.3.0'; + $this->plugin->version = '1.3.2'; $this->apiVersion = get_option( 'rest_api_plugin_version', get_option( 'json_api_plugin_version', null ) ); @@ -49,7 +49,6 @@ class ACFtoWPAPI { $this->_versionTwoSetup(); } } - /** * Die and dump * @@ -213,9 +212,11 @@ class ACFtoWPAPI { * * @return void * + * @since 1.3.2 Adds support for pages and public custom post types * @since 1.3.0 */ function addACFDataPostV2() { + // Posts register_api_field( 'post', 'acf', array( @@ -224,6 +225,32 @@ class ACFtoWPAPI { 'schema' => null, ) ); + + // Pages + register_api_field( 'page', + 'acf', + array( + 'get_callback' => array( $this, 'addACFDataPostV2cb' ), + 'update_callback' => null, + 'schema' => null, + ) + ); + + // Public custom post types + $types = get_post_types(array( + 'public' => true, + '_builtin' => false + )); + foreach($types as $key => $type) { + register_api_field( $type, + 'acf', + array( + 'get_callback' => array( $this, 'addACFDataPostV2cb' ), + 'update_callback' => null, + 'schema' => null, + ) + ); + } } /** @@ -397,22 +424,23 @@ class ACFtoWPAPI { * * @return void * + * @since 1.3.1 Switched to array() notation (over [] notation) to support PHP < 5.4 * @since 1.3.0 */ function addACFOptionRouteV2() { - register_rest_route( 'wp/v2/acf', '/options', [ - 'methods' => [ + register_rest_route( 'wp/v2/acf', '/options', array( + 'methods' => array( 'GET' - ], + ), 'callback' => array( $this, 'addACFOptionRouteV2cb' ) - ] ); + ) ); - register_rest_route( 'wp/v2/acf', '/options/(?P