hsimah-services / wp-graphql-mb-relationships
WPGraphQL integration for MB Relationships
Installs: 200
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 4
Forks: 0
Open Issues: 3
Type:wordpress-plugin
Requires
- php: ^7.1||^8.0
This package is auto-updated.
Last update: 2024-10-26 09:34:58 UTC
README
WPGraphQL Provider for MB Relationships
This is a simple WPGraphQL integration plugin for Meta Box Relationships. It only supports post types at the moment.
There are three new fields to add to the API configuration:
show_in_graphql
- a boolean to show the connection in the schemagraphql_name
- the name of the connection field in the schemagraphql_args
- the connection args (optional)resolve
- the resolve handler (see WPGraphQL documentation) (experimental)resolve_node
- the node resolve handler (see WPGraphQL documentaiton) (experimental)
MB_Relationships_API::register( [
'id' => 'linked_posts',
'from' => array(
'show_in_graphql' => true,
'graphql_name' => 'goingUp',
'graphql_args' => [
'higher' => [
'type' => 'Boolean',
'description' => 'Field Description',
],
],
'object_type' => 'post',
'post_type' => 'mypost',
'meta_box' => [
'title' => 'Going Up!',
'context' => 'side',
],
],
'to' => [
'show_in_graphql' => true,
'graphql_name' => 'goingDown',
'object_type' => 'post',
'post_type' => 'mypost',
'meta_box' => [
'title' => 'Going Down!',
'context' => 'side',
'empty_message' => 'None',
],
],
]
);