Skip to content

Commit bab9cee

Browse files
committed
Removed all GQL functions
1 parent 4dcbc92 commit bab9cee

File tree

11 files changed

+22
-781
lines changed

11 files changed

+22
-781
lines changed

blocks/README.md

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,10 @@ https://www.advancedcustomfields.com/resources/blocks/
66
1. Be sure to set a good icon.
77

88
1. Create ACF field group, set location as Form > Block. Be sure to select "Show in GraphQL". You don't need to se the GraphQL types manually. The default works.
9-
1. Refresh Gutenberg Block cache in menu graphql > gutenberg
10-
1. Verify that new component is available in gutenberg editor or graphiql (note you may need to clear site cache)
9+
1. Verify that new component is available in the editor (note you may need to clear site cache)
1110
1. Create backend PHP template and styles
1211
1. in /blocks/ dir add new dir for block (eg "/block/slideshow")
1312
1. add template to `/block/slideshow/block.php`
1413
1. add styles to `/block/slideshow/block.css`
15-
1. Add GQL to /gql/fragments/GutenbergBlocks.gql query. Be sure to alias your fields with `fields` like so:
16-
```
17-
# Custom Blocks
18-
fragment SlideshowBlock on Block {
19-
... on AcfSlideshowBlock {
20-
# AcfCreditBlock is always like `Acf${BlockName}Block`
21-
attributes {
22-
wpClasses: className
23-
}
24-
fields: blockSlideshow {
25-
# blockSlideshow is the ACF field group name
26-
slides {
27-
...MediaImage
28-
}
29-
}
30-
}
31-
}
32-
```
33-
1. Import Component to the WpGutenberg.vue file for lazy loading
34-
1. Build frontend Vue template in `/components/gutenberg`
35-
1. See Missing Pieces for demos
14+
1. Import Component to the WpContent.vue file for lazy loading
15+
1. Build frontend Vue template in `/components/wp-block`

css/admin.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ body:not(.is-developer) #toplevel_page_edit-post_type-acf-field-group {
2525
body.post-php.is-developer-locked:not(.is-developer) #edit-slug-buttons {
2626
display: none;
2727
}
28-
body:not(.is-developer) #wp-admin-bar-graphiql-ide,
29-
body:not(.is-developer) #adminmenu #toplevel_page_graphql,
30-
body:not(.is-developer) #adminmenu #toplevel_page_wp-graphiql-wp-graphiql,
31-
body:not(.is-developer) #adminmenu #toplevel_page_wp-graphql-gutenberg-admin
28+
body:not(.is-developer) #toplevel_page_wp-openapi,
3229
body:not(.is-developer) #adminmenu #toplevel_page_proxy-settings {
3330
display: none;
3431
}

favicon.png

2.19 KB
Loading

functions.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
* Load all modules.
1212
*/
1313
require_once get_template_directory() . '/functions/wp-functions.php';
14-
require_once get_template_directory() . '/functions/gql-functions.php';
1514
require_once get_template_directory() . '/functions/theme-config.php';
1615
require_once get_template_directory() . '/functions/gutenberg-functions.php';
1716
require_once get_template_directory() . '/functions/acf-functions.php';
@@ -21,4 +20,4 @@
2120
require_once get_template_directory() . '/functions/developer-role.php';
2221
require_once get_template_directory() . '/functions/widgets.php';
2322
require_once get_template_directory() . '/functions/svg.php';
24-
require_once get_template_directory() . '/functions/proxy.php';
23+
require_once get_template_directory() . '/functions/proxy.php';

functions/deprecated.php

Lines changed: 1 addition & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -46,102 +46,4 @@ function fuxt_custom_blocks() {
4646
);
4747

4848
}
49-
//add_action( 'acf/init', 'fuxt_custom_blocks' );
50-
51-
/**
52-
* Extend GraphQL to add a mutation to send emails via the wp_mail() function.
53-
* SEE https://developer.wordpress.org/reference/functions/wp_mail/ for more info on how each input works.
54-
* SEE https://docs.wpgraphql.com/extending/mutations/
55-
*/
56-
function gql_register_email_mutation() {
57-
// Define the input parameters
58-
$input_fields = array(
59-
'to' => array(
60-
'type' => array( 'list_of' => 'String' ),
61-
'description' =>
62-
'Array of email addresses to send email to. Must comply to RFC 2822 format.',
63-
),
64-
'subject' => array(
65-
'type' => 'String',
66-
'description' => 'Email subject.',
67-
),
68-
'message' => array(
69-
'type' => 'String',
70-
'description' => 'Message contents.',
71-
),
72-
'headers' => array(
73-
'type' => array( 'list_of' => 'String' ),
74-
'description' =>
75-
'Array of any additional headers. This is how you set BCC, CC and HTML type. See wp_mail() function for more details.',
76-
),
77-
'trap' => array(
78-
'type' => 'String',
79-
'description' =>
80-
'Crude anti-spam measure. This must equal the clientMutationId, otherwise the email will not be sent.',
81-
),
82-
);
83-
84-
// Define the ouput parameters
85-
$output_fields = array(
86-
'to' => array(
87-
'type' => array( 'list_of' => 'String' ),
88-
'description' =>
89-
'Array of email addresses to send email to. Must comply to RFC 2822 format.',
90-
),
91-
'subject' => array(
92-
'type' => 'String',
93-
'description' => 'Email subject.',
94-
),
95-
'message' => array(
96-
'type' => 'String',
97-
'description' => 'Message contents.',
98-
),
99-
'headers' => array(
100-
'type' => array( 'list_of' => 'String' ),
101-
'description' =>
102-
'Array of any additional headers. This is how you set BCC, CC and HTML type. See wp_mail() function for more details.',
103-
),
104-
'sent' => array(
105-
'type' => 'Boolean',
106-
'description' => 'Returns true if the email was sent successfully.',
107-
'resolve' => function ( $payload, $args, $context, $info ) {
108-
return isset( $payload['sent'] ) ? $payload['sent'] : false;
109-
},
110-
),
111-
);
112-
113-
// This function processes the submitted data
114-
$mutate_and_get_payload = function ( $input, $context, $info ) {
115-
// Spam honeypot. Make sure that the clientMutationId matches the trap input.
116-
if ( $input['clientMutationId'] !== $input['trap'] ) {
117-
throw new \GraphQL\Error\UserError( 'You got caught in a spam trap' );
118-
}
119-
120-
// Vailidate email before trying to send
121-
foreach ( $input['to'] as $email ) {
122-
if ( ! is_email( $email ) ) {
123-
throw new \GraphQL\Error\UserError( 'Invalid email address: ' . $email );
124-
}
125-
}
126-
127-
// Send email!
128-
$input['sent'] = wp_mail(
129-
$input['to'],
130-
$input['subject'],
131-
$input['message'],
132-
$input['headers'],
133-
$input['attachments']
134-
);
135-
136-
return $input;
137-
};
138-
139-
// Add mutation to WP-GQL now
140-
$args = array(
141-
'inputFields' => $input_fields,
142-
'outputFields' => $output_fields,
143-
'mutateAndGetPayload' => $mutate_and_get_payload,
144-
);
145-
register_graphql_mutation( 'sendEmail', $args );
146-
}
147-
//add_action( 'graphql_register_types', 'gql_register_email_mutation' );
49+
//add_action( 'acf/init', 'fuxt_custom_blocks' );

0 commit comments

Comments
 (0)