'fullclass_booking_render_block', ) ); } add_action( 'init', 'fullclass_booking_register_block' ); /** * Render callback for the block. * * @param array $attributes Block attributes. * @return string HTML. */ function fullclass_booking_render_block( $attributes ) { $html = fullclass_booking_render( array( 'category' => isset( $attributes['category'] ) ? $attributes['category'] : '', 'view' => isset( $attributes['view'] ) ? $attributes['view'] : '', ) ); if ( '' === $html ) { return ''; } return '
' . $html . '
'; } /** * Tell the editor script whether a key is saved, so the block can say so. */ function fullclass_booking_editor_data() { wp_add_inline_script( 'fullclass-booking-editor-script', 'window.fullclassBookingEditor = ' . wp_json_encode( array( 'connected' => '' !== (string) get_option( FULLCLASS_BOOKING_OPTION_KEY, '' ), 'settingsUrl' => admin_url( 'options-general.php?page=fullclass-booking' ), ) ) . ';', 'before' ); } add_action( 'enqueue_block_editor_assets', 'fullclass_booking_editor_data' );