Let the additional third party widgets create and sanitize form fields
This commit is contained in:
parent
441530f54e
commit
afd3aa2fc7
|
@ -170,6 +170,16 @@ abstract class WC_Widget extends WP_Widget {
|
|||
$instance[ $key ] = sanitize_text_field( $new_instance[ $key ] );
|
||||
break;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize the value of a setting.
|
||||
*/
|
||||
$instance[ $key ] = apply_filters( 'woocommerce_widget_settings_sanitize_option', $instance[ $key ], $new_instance, $key, $setting );
|
||||
|
||||
/**
|
||||
* Sanitize the value of a setting by its key.
|
||||
*/
|
||||
$instance[ $key ] = apply_filters( "woocommerce_widget_settings_sanitize_option_$key", $instance[ $key ], $new_instance, $key, $setting );
|
||||
}
|
||||
|
||||
$this->flush_widget_cache();
|
||||
|
@ -247,6 +257,11 @@ abstract class WC_Widget extends WP_Widget {
|
|||
</p>
|
||||
<?php
|
||||
break;
|
||||
|
||||
// Default: run an action
|
||||
default:
|
||||
do_action( 'woocommerce_widget_field_' . $setting['type'], $key, $setting, $class, $value, $instance );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue