WC_REST_Setting_Options_V2_Controller::cast_image_width() public WC 3.0.0
For image_width, Crop can return "0" instead of false -- so we want to make sure we return these consistently the same we accept them.
{} It's a method of the class: WC_REST_Setting_Options_V2_Controller{}
No Hooks.
Return
Array.
Usage
$WC_REST_Setting_Options_V2_Controller = new WC_REST_Setting_Options_V2_Controller(); $WC_REST_Setting_Options_V2_Controller->cast_image_width( $setting );
- $setting(array) (required)
- Settings.
Changelog
Since 3.0.0 | Introduced. |
Code of WC_REST_Setting_Options_V2_Controller::cast_image_width() WC REST Setting Options V2 Controller::cast image width WC 5.0.0
public function cast_image_width( $setting ) {
foreach ( array( 'default', 'value' ) as $key ) {
if ( isset( $setting[ $key ] ) ) {
$setting[ $key ]['width'] = intval( $setting[ $key ]['width'] );
$setting[ $key ]['height'] = intval( $setting[ $key ]['height'] );
$setting[ $key ]['crop'] = (bool) $setting[ $key ]['crop'];
}
}
return $setting;
}