%s', esc_url( self::url() ), esc_html__( 'Settings', 'shift-snapcopy' ) ) ); return $links; } /** * Enqueues the React app on the page only. * * @param string $hook_suffix Current admin page. */ public static function enqueue( string $hook_suffix ): void { if ( ! self::$hook || self::$hook !== $hook_suffix ) { return; } $asset_file = SHIFTSNAP_DIR . 'build/settings.asset.php'; if ( ! is_readable( $asset_file ) ) { return; } $asset = require $asset_file; wp_enqueue_script( self::HANDLE, SHIFTSNAP_URL . 'build/settings.js', $asset['dependencies'], $asset['version'], true ); wp_set_script_translations( self::HANDLE, 'shift-snapcopy' ); wp_enqueue_style( self::HANDLE, SHIFTSNAP_URL . 'build/settings.css', array( 'wp-components' ), $asset['version'] ); } /** * Page container; the script renders inside it. */ public static function render(): void { if ( ! current_user_can( 'edit_posts' ) ) { return; } echo '
' . esc_html__( 'Loading…', 'shift-snapcopy' ) . '