Sharing. * * @package automattic/jetpack-sharing-likes */ declare( strict_types = 1 ); namespace Automattic\Jetpack\Sharing_Likes\Settings; /** * Renders the Sharing buttons section. */ final class Sharing_Section { /** * Nonce action for this section's action buttons. */ public const NONCE_ACTION = 'jetpack-sharing-options'; /** * Render the section. */ public static function render(): void { $state = self::state(); echo '
%s
', esc_html__( 'Add the Sharing Buttons block to your theme’s template.', 'jetpack-sharing-likes' ) ); self::render_site_editor_link(); } /** * The module is off on a theme with no block route. * * Nothing else on this site produces sharing buttons, so this is the one * place the feature can be switched back on. */ private static function render_off(): void { printf( '%s
', esc_html__( 'Sharing buttons are turned off for this site.', 'jetpack-sharing-likes' ) ); self::render_activate_form(); } /** * The way back. See `Post_Handler::activate_module()`. */ private static function render_activate_form(): void { if ( ! Environment::legacy_sharing_supported() ) { printf( '%s
', esc_html__( 'Connect your site to WordPress.com, or enable offline mode, to turn them back on.', 'jetpack-sharing-likes' ) ); return; } Post_Handler::render_action_form( 'activate-sharing', self::NONCE_ACTION, __( 'Turn on sharing buttons', 'jetpack-sharing-likes' ) ); } /** * The buttons are live, but the site would be better served by the block. */ private static function render_block_nudge(): void { echo '%s
', esc_html__( 'Legacy sharing buttons cannot be customized on block themes. Use the Sharing Buttons block in your theme’s template instead.', 'jetpack-sharing-likes' ) ); Post_Handler::render_action_form( 'switch-to-block-sharing', self::NONCE_ACTION, __( 'Switch to the Sharing Buttons block', 'jetpack-sharing-likes' ), false ); echo '