addField( 'general', esc_html__( 'Auto save', 'js_composer' ), 'auto_save', 'vc_auto_save_sanitize_disable_callback', 'vc_auto_save_disable_render_callback', array( 'info' => esc_html__( 'Enable auto-save, or use legacy save.', 'js_composer' ) ) ); } } if ( ! function_exists( 'vc_auto_save_sanitize_disable_callback' ) ) { /** * Sanitizes the auto-save option. * * @param mixed $rules The auto-save rules. * @return bool Sanitized auto-save status. * @since 7.6 */ function vc_auto_save_sanitize_disable_callback( $rules ) { return (bool) $rules; } } if ( ! function_exists( 'vc_auto_save_disable_render_callback' ) ) { /** * Renders the auto-save checkbox in the WordPress dashboard, * under WPBakery -> General Settings. * * @since 7.6 */ function vc_auto_save_disable_render_callback() { $checked = get_option( 'wpb_js_auto_save', false ); ?> array( array( 'name' => 'close', 'label' => esc_html__( 'Close', 'js_composer' ), 'css_classes' => 'vc_ui-button-fw', ), array( 'name' => 'save', 'label' => esc_html__( 'Save changes', 'js_composer' ), 'css_classes' => 'vc_ui-button-fw', 'style' => 'action', ), ), )); } } } add_action( 'vc_settings_tab-general', 'vc_auto_save_add_settings' ); add_action( 'wpb_add_element_controls', 'wpb_add_element_controls' );