Skip to content

Commit 726eb84

Browse files
committed
add filter to allow setting a default API key
1 parent a404967 commit 726eb84

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

wc-am-client.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,12 @@ public function wc_am_activation_info() {
753753

754754
// Returns API Key text field
755755
public function wc_am_api_key_field() {
756-
if ( ! empty( $this->data[ $this->wc_am_api_key_key ] ) ) {
757-
echo "<input id='api_key' name='" . esc_attr( $this->data_key ) . "[" . esc_attr( $this->wc_am_api_key_key ) . "]' size='25' type='text' value='" . esc_attr( $this->data[ $this->wc_am_api_key_key ] ) . "' />";
756+
$value = ! empty( $this->data[ $this->wc_am_api_key_key ] ) ? $this->data[ $this->wc_am_api_key_key ] : '';
757+
758+
// filter @since 2.9.2
759+
$value = apply_filters( 'wc_am_api_key_field_value', $value, $this->data_key, $this->data );
760+
if ( $value ) {
761+
echo "<input id='api_key' name='" . esc_attr( $this->data_key ) . "[" . esc_attr( $this->wc_am_api_key_key ) . "]' size='25' type='text' value='" . esc_attr( $value ) . "' />";
758762
} else {
759763
echo "<input id='api_key' name='" . esc_attr( $this->data_key ) . "[" . esc_attr( $this->wc_am_api_key_key ) . "]' size='25' type='text' value='' />";
760764
}

0 commit comments

Comments
 (0)