From b668cd725bf53dc63b8144dc293fdff152df2831 Mon Sep 17 00:00:00 2001 From: RayQ Date: Fri, 27 Nov 2020 17:14:05 +0000 Subject: [PATCH] testing --- library/context/post.php | 12 +++++++++++ library/get/post.php | 42 +++++++++++++++++++++++++++++++++++++++ library/render/fields.php | 5 ++++- 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/library/context/post.php b/library/context/post.php index 8979718..2b4add0 100644 --- a/library/context/post.php +++ b/library/context/post.php @@ -57,6 +57,18 @@ public static function get( $args = null ){ } + /** + * Full object callback + * + * @since 4.1.0 + */ + public static function data( $args = null ){ + + return [ 'data' => \willow\get\post::data( $args ) ]; + + } + + /** * Render WP_Query diff --git a/library/get/post.php b/library/get/post.php index d8bd45e..5a33f53 100644 --- a/library/get/post.php +++ b/library/get/post.php @@ -419,6 +419,48 @@ public static function content( $args = null ){ } + /** + * Get Post object data to render + * + * @since 1.6.2 + * @return Array + */ + public static function data( $args = null ){ + + // sanity ## + if ( + is_null( $args ) + || ! is_array( $args ) + ){ + + h::log( 'e:>Error in pased args' ); + + return false; + + } + + // to make this more generic, we will get the current wp_post, if this is not passed ## + if ( + ! isset( $args['config']['post'] ) + || ! ( $args['config']['post'] instanceof \WP_Post ) + ){ + + $post = get\post::object(); + + } else { + + $post = $args['config']['post']; + + } + + // h::log( $post ); + + // return post object to Willow ## + return $post; + + } + + /** * Returns the permalink for a page based on the incoming slug. diff --git a/library/render/fields.php b/library/render/fields.php index 1f9f584..6bcc421 100644 --- a/library/render/fields.php +++ b/library/render/fields.php @@ -22,9 +22,12 @@ public static function prepare(){ || ! is_array( self::$fields ) ) { - /// log ## + // h::log( self::$fields ); + + // log ## h::log( self::$args['task'].'~>e:>Error in $fields array' ); + // kick out ## return false; }