Add route block

This commit is contained in:
Justin Foell
2021-01-29 16:06:21 -06:00
parent c7c07fec47
commit c91c65cc8b
7 changed files with 413 additions and 98 deletions
+15 -1
View File
@@ -62,6 +62,17 @@ class WPStrava {
return self::$instance;
}
/**
* Check if rest request to skip link rendering in block editor.
*
* @return boolean
* @author Justin Foell <justin@foell.org>
* @since 2.6.0
*/
public static function is_rest_request() {
return defined( 'REST_REQUEST' ) && REST_REQUEST;
}
/**
* Function to install hooks at WP runtime.
*
@@ -188,7 +199,10 @@ class WPStrava {
* @see https://wordpress.org/gutenberg/handbook/blocks/writing-your-first-block-type/#enqueuing-block-scripts
*/
public function register_blocks() {
static $blocks = array( 'WPStrava_Blocks_Activity' );
static $blocks = array(
'WPStrava_Blocks_Activity',
'WPStrava_Blocks_Route',
);
// automatically load dependencies and version
$asset_file = include WPSTRAVA_PLUGIN_DIR . 'build/index.asset.php';