array( Output::class, 'render_block' ), ) ); wp_set_script_translations( 'sr-anywhere-module-editor-script', 'sr-anywhere' ); wp_add_inline_script( 'sr-anywhere-module-editor-script', 'window.sranywhereEditor=' . wp_json_encode( array( 'settingsUrl' => admin_url( 'options-general.php?page=sr-anywhere' ), 'canConnect' => current_user_can( 'manage_options' ), 'portalUrl' => Config::portal_url(), 'deliveryUrl' => Config::delivery_url(), 'classicOld' => Settings::classic_outdated(), 'classicFix' => Settings::CLASSIC_FIXED, ) ) . ';', 'before' ); } /** * The SR Anywhere look (decision 0015): the design system's tokens and controls (generated, `assets/sra.css`) and the * plugin's own layout on top (`assets/admin.css`). */ public static function register_styles() { if ( wp_style_is( 'sranywhere-ui', 'registered' ) ) { return; } wp_register_style( 'sranywhere-ui', SRANYWHERE_URL . 'assets/sra.css', array(), SRANYWHERE_VERSION ); wp_register_style( 'sranywhere-admin', SRANYWHERE_URL . 'assets/admin.css', array( 'sranywhere-ui' ), SRANYWHERE_VERSION ); } /** * The look for the editor's own panels (the block's sidebar sits outside the editor's canvas). */ public static function editor_assets() { self::register_styles(); wp_enqueue_style( 'sranywhere-ui' ); } }