-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Custom ticket field types and queries implemented. #40
feat: Custom ticket field types and queries implemented. #40
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking pretty great! Just a couple of minor tweaks.
includes/class-type-registry.php
Outdated
\WPGraphQL\QL_Events\Type\WPInterface\Ticket_Field::register_type(); | ||
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Birthdate::register(); | ||
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Checkbox::register(); | ||
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Date::register(); | ||
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Dropdown::register(); | ||
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Email::register(); | ||
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Phone::register(); | ||
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Radio::register(); | ||
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Text::register(); | ||
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\URL::register(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could simplify this down to the following, due to the namespace at the top of the file:
\WPGraphQL\QL_Events\Type\WPInterface\Ticket_Field::register_type(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Birthdate::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Checkbox::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Date::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Dropdown::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Email::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Phone::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Radio::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Text::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\URL::register(); | |
Type\WPInterface\Ticket_Field::register_type(); | |
Type\WPObject\Ticket_Field\Birthdate::register(); | |
Type\WPObject\Ticket_Field\Checkbox::register(); | |
Type\WPObject\Ticket_Field\Date::register(); | |
Type\WPObject\Ticket_Field\Dropdown::register(); | |
Type\WPObject\Ticket_Field\Email::register(); | |
Type\WPObject\Ticket_Field\Phone::register(); | |
Type\WPObject\Ticket_Field\Radio::register(); | |
Type\WPObject\Ticket_Field\Text::register(); | |
Type\WPObject\Ticket_Field\URL::register(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even add use WPGraphQL\QL_Events\Type\WPObject\Ticket_Field;
at the top then change to:
\WPGraphQL\QL_Events\Type\WPInterface\Ticket_Field::register_type(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Birthdate::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Checkbox::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Date::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Dropdown::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Email::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Phone::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Radio::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\Text::register(); | |
\WPGraphQL\QL_Events\Type\WPObject\Ticket_Field\URL::register(); | |
Ticket_Field::register_type(); | |
Ticket_Field\Birthdate::register(); | |
Ticket_Field\Checkbox::register(); | |
Ticket_Field\Date::register(); | |
Ticket_Field\Dropdown::register(); | |
Ticket_Field\Email::register(); | |
Ticket_Field\Phone::register(); | |
Ticket_Field\Radio::register(); | |
Ticket_Field\Text::register(); | |
Ticket_Field\URL::register(); |
public static function register_type() { | ||
register_graphql_interface_type( | ||
'TicketField', | ||
array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we switch to short array syntax? []
rather than array()
?
$fieldsets = tribe( 'tickets-plus.meta' )->meta_fieldset()->get_fieldsets(); | ||
|
||
foreach( $fieldsets as $fieldset ) { | ||
print_r( $fieldset ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this debug line. 🕺
// 'test' => array( | ||
// 'type' => 'String', | ||
// 'resolve' => function() use( $fieldset ) { | ||
// return wp_json_encode( $fieldset ); | ||
// } | ||
// ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove?
aa7def8
to
262406f
Compare
0bf4df9
to
7b054de
Compare
Summary
ticketFields
field to the Product typeExample Query
ticketFields
field to the EventExample Query
TODO
Event
->ticketFields
unit testProduct
->ticketFields
unit test