array(), 'theme_uri' => $theme->get('Theme URI') ?: admin_url('themes.php'), )); wp_localize_script('bluetone-script', 'RealtimeThemesHelper', array( 'allowedBlocks' => $settings['allowed_blocks'], 'themeUri' => $theme->get('Theme URI') ?: admin_url('themes.php'), )); } add_action('admin_enqueue_scripts', 'realtime_themes_helper_admin_assets'); add_action('admin_enqueue_scripts', 'realtime_themes_helper_admin_assets'); function realtime_themes_helper_render_admin_page() { if (! current_user_can('manage_options')) { return; } $theme = wp_get_theme(); $settings = realtime_themes_helper_get_settings(); $all_blocks = class_exists('WP_Block_Type_Registry') ? WP_Block_Type_Registry::get_instance()->get_all_registered() : array(); echo '
'; // Intro with video echo '

Real Time Themes Helper

Manage blocks and patterns simplifying the customization process and even better, purchase this theme in the pro version to increase the styling standard with new patterns, styles and effects.

Upgrade to PRO Theme Version
'; echo '
'; ?>

Upgrade to the Pro Version and unlock exclusive features by purchasing this theme at a discounted rate today!

Here's what you'll receive:

  • Access to the Pro version, complete with advanced effects, pre-built pages, and an expanded homepage layout
  • Removal of footer ads for a cleaner, professional look
  • A commercial license granting you full rights to use the Pro version

'; echo '
'; settings_fields('realtime_themes_helper_settings_group'); do_settings_sections('bluetone'); // Tabs + save button aligned right but outside the border echo '
'; // Tabs echo ''; // Save button outside the tab wrapper echo '
'; submit_button(__('Save Settings', 'bluetone'), 'primary', '', false); echo ''; echo '
'; echo '
'; // Tab content echo '
'; echo '

' . esc_html__('Select the blocks you want to ALLOW moving in the editor (all others are blocked).', 'bluetone') . '

'; echo '

' . esc_html__('By default, all blocks are locked. Check the ones you want to allow moving.', 'bluetone') . '

'; echo '
'; $index = 0; foreach ($all_blocks as $name => $obj) { $allowed = in_array($name, $settings['allowed_blocks'], true) ? 'checked' : ''; $id = 'allow-move-' . $index; echo ''; echo ''; $index++; } echo '
'; echo '
'; echo '
'; echo ''; echo '
'; } function realtime_themes_helper_register_settings() { register_setting( 'realtime_themes_helper_settings_group', 'realtime_themes_helper_settings', array( 'sanitize_callback' => 'realtime_themes_helper_sanitize_settings', ) ); } add_action('admin_init', 'realtime_themes_helper_register_settings'); function realtime_themes_helper_sanitize_settings($input) { if (isset($_POST['realtime_themes_helper_reset'])) { return array( 'allowed_blocks' => array(), ); } $output = array( 'allowed_blocks' => array(), ); if (isset($input['allowed_blocks']) && is_array($input['allowed_blocks'])) { $output['allowed_blocks'] = array_map('sanitize_text_field', $input['allowed_blocks']); } return $output; }