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