-
Notifications
You must be signed in to change notification settings - Fork 1
[WIP] Jobber Schedule Block #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
Conversation
| * Register the block types. | ||
| */ | ||
| public function register_block_types() { | ||
| register_block_type( |
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.
Would it be better to check if we have a valid access token before we register the block? Right now I can add the block immediately after activating the plugin, though it will show an error message. I guess I can see two approaches:
- Don't register the block at all until an account has been connected
- Register the block but update our error message in the admin to point people to the settings page so they can authenticate
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.
Thinking about it more, there is a potential for someone to activate the plugin, totally miss the authentication step and then wonder why there isn't a block for them to use. In that scenario, I think option 2 above is the right approach. Always register the block but let's show a better error message, prompting them to go to the settings screen to authenticate.
Would be great if we could check for an access token before making the API request and instead show the component (or something similar) with messaging that prompts someone to go authenticate.
| $jobber = new \Jobber\Jobber(); | ||
| $response = $jobber->get_form( $form_type ); | ||
|
|
||
| if ( is_wp_error( $response ) ) { |
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.
If we encounter an error or we don't have a valid URL to display, wondering if we want to output an error message. I think that would just confuse users and may be better to just not render anything
Description of the Change
This PR introduces a Gutenberg block for “Jobber Schedule,” allowing users to easily insert a Jobber booking/request form into any WordPress page using the native block editor.
Closes #6
How to test the Change
Ensure the block works as expected in #6.
Changelog Entry
Credits
Props @vikrampm1 @faisal-alvi
Checklist: