'runline_render_block' ) ); $handle = generate_block_asset_handle( 'runline/bar', 'editorScript' ); $script = wp_scripts()->query( $handle, 'registered' ); if ( ! $script ) { return; } // runline.js sets the speed of the preview (window.runlineInit). $script->deps[] = 'runline'; wp_set_script_translations( $handle, 'runline', RUNLINE_DIR . 'languages' ); wp_add_inline_script( $handle, 'window.runlineBlock = ' . wp_json_encode( array( 'fonts' => runline_font_stacks(), 'maxItems' => runline_max_items(), 'tzOffset' => (int) ( wp_timezone()->getOffset( new DateTime( 'now', wp_timezone() ) ) / 60 ), 'daysFormat' => runline_countdown_days_format(), 'vars' => runline_text_vars(), 'shipping' => array( 'auto' => runline_free_shipping_threshold( runline_default_settings() ), 'fmt' => runline_price_format(), ), 'adminUrl' => admin_url( 'admin.php?page=runline' ), 'canManage' => current_user_can( 'manage_options' ), ) ) . ';', 'before' ); } /** * The block on the site: the same bar as the shortcode, in the block wrapper (alignment, margin). * * @param array $attributes Block attributes. */ function runline_render_block( $attributes ) { $html = runline_shortcode( array( 'id' => isset( $attributes['barId'] ) ? (int) $attributes['barId'] : 0 ) ); if ( '' === $html ) { return ''; } return '
' . $html . '
'; }