Skip to content

Commit

Permalink
Adds update included from #25
Browse files Browse the repository at this point in the history
  • Loading branch information
ThyNameIsMud authored and pristas-peter committed May 8, 2021
1 parent 52c43a8 commit 8a89f38
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,26 @@ function init() {
return;
}

/**
* Return the instance of WPGraphQLGutenbergACF
*/
return WPGraphQLGutenbergACF::instance();
add_filter(
'graphql_acf_get_root_id',
function ( $id, $root ) {
return WPGraphQLGutenbergACF::instance()->get_root_id( $id, $root );
},
10,
2
);

add_filter(
'graphql_gutenberg_block_type_fields',
function ( $fields, $block_type, $type_registry ) {
return WPGraphQLGutenbergACF::instance()->block_type_fields( $fields, $block_type, $type_registry );
},
10,
3
);
}

add_action( 'init', '\WPGraphQLGutenbergACF\init' );
add_action( 'init', '\WPGraphQLGutenbergACF\init', 100 );


/**
Expand Down Expand Up @@ -186,22 +199,22 @@ function can_load_plugin() {
if ( ! class_exists( 'ACF' ) ) {
return false;
}

// Is WPGraphQL active?
if ( ! class_exists( 'WPGraphQL' ) ) {
return false;
}

// is WPGraphQLACF active?
if ( ! class_exists( 'WPGraphQL\ACF\ACF' ) ) {
return false;
}

// is WPGraphQLGutenberg active?
if ( ! class_exists( 'WPGraphQLGutenberg\WPGraphQLGutenberg' ) ) {
return false;
}


return true;
}
}

0 comments on commit 8a89f38

Please sign in to comment.