WC_REST_Setting_Options_V2_Controller::cast_image_width()publicWC 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.

Метод класса: WC_REST_Setting_Options_V2_Controller{}

Хуков нет.

Возвращает

Массив.

Использование

$WC_REST_Setting_Options_V2_Controller = new WC_REST_Setting_Options_V2_Controller();
$WC_REST_Setting_Options_V2_Controller->cast_image_width( $setting );
$setting(массив) (обязательный)
Settings.

Список изменений

С версии 3.0.0 Введена.

Код WC_REST_Setting_Options_V2_Controller::cast_image_width() WC 8.7.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;
}