WC_Payment_Gateways::was_gateway_disabled
Determines from changes in settings if a gateway was disabled.
Метод класса: WC_Payment_Gateways{}
Хуков нет.
Возвращает
bool. Whether the gateway was disabled or not.
Использование
// private - только в коде основоного (родительского) класса $result = $this->was_gateway_disabled( $value, $old_value );
- $value(массив) (обязательный)
- New value.
- $old_value(массив)
- Old value.
По умолчанию:null
Код WC_Payment_Gateways::was_gateway_disabled() WC Payment Gateways::was gateway disabled WC 11.2.2
private function was_gateway_disabled( $value, $old_value = null ) {
if ( null === $old_value ) {
// There was no old value, so this is a new option.
// We don't consider a new option for determining if a gateway was disabled.
return false;
}
// There was an old value, so this is an update.
if (
ArrayUtil::get_value_or_default( $value, 'enabled' ) === 'no' &&
ArrayUtil::get_value_or_default( $old_value, 'enabled' ) !== 'no' ) {
return true;
}
return false;
}