should_add_sub_menu() ) { return; } return add_submenu_page( 'jetpack', __( 'Search Settings', 'jetpack' ), _x( 'Search', 'product name shown in menu', 'jetpack' ), 'manage_options', 'jetpack-search', array( $this, 'render' ), $this->get_link_offset() ); } /** * Enqueue and localize page specific scripts */ public function page_admin_scripts() { $this->load_admin_styles(); $this->load_admin_scripts(); } /** * Override render funtion */ public function render() { $this->page_render(); } /** * Render Search setting elements */ public function page_render() { ?>
is_offline_mode() && Jetpack::is_connection_ready() ) { // Required for Analytics. Automattic\Jetpack\Tracking::register_tracks_functions_scripts( true ); } wp_enqueue_script( 'jp-search-dashboard', plugins_url( '_inc/build/search-dashboard.js', JETPACK__PLUGIN_FILE ), $script_dependencies, JETPACK__VERSION, true ); // Add objects to be passed to the initial state of the app. // Use wp_add_inline_script instead of wp_localize_script, see https://core.trac.wordpress.org/ticket/25280. wp_add_inline_script( 'jp-search-dashboard', 'var Initial_State=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( \Jetpack_Redux_State_Helper::get_initial_state() ) ) . '"));', 'before' ); wp_set_script_translations( 'jp-search-dashboard', 'jetpack' ); } }