Skip to content

Commit 727467f

Browse files
committed
Re-ordered account ID / API token on settings page.
1 parent 74bfc5d commit 727467f

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/inc/class-cloudflare-stream-settings.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public function setup() {
7373
public function action_admin_init() {
7474

7575
// Register Settings.
76-
register_setting( self::SETTING_GROUP, self::OPTION_API_TOKEN );
7776
register_setting( self::SETTING_GROUP, self::OPTION_API_ACCOUNT );
77+
register_setting( self::SETTING_GROUP, self::OPTION_API_TOKEN );
7878
register_setting( self::SETTING_GROUP, self::OPTION_SIGNED_URLS );
7979
register_setting( self::SETTING_GROUP, self::OPTION_SIGNED_URLS_DURATION );
8080
register_setting( self::SETTING_GROUP, self::OPTION_MEDIA_DOMAIN );
@@ -87,17 +87,17 @@ public function action_admin_init() {
8787
);
8888

8989
add_settings_field(
90-
self::OPTION_API_TOKEN,
91-
esc_html__( 'API Token', 'cloudflare-stream-wordpress' ),
92-
array( $this, 'api_token_cb' ),
90+
self::OPTION_API_ACCOUNT,
91+
esc_html__( 'API Account ID', 'cloudflare-stream-wordpress' ),
92+
array( $this, 'api_account_cb' ),
9393
self::SETTING_PAGE,
9494
self::SETTING_SECTION_GENERAL
9595
);
9696

9797
add_settings_field(
98-
self::OPTION_API_ACCOUNT,
99-
esc_html__( 'API Account ID', 'cloudflare-stream-wordpress' ),
100-
array( $this, 'api_account_cb' ),
98+
self::OPTION_API_TOKEN,
99+
esc_html__( 'API Token', 'cloudflare-stream-wordpress' ),
100+
array( $this, 'api_token_cb' ),
101101
self::SETTING_PAGE,
102102
self::SETTING_SECTION_GENERAL
103103
);
@@ -130,17 +130,6 @@ public function action_admin_init() {
130130
add_action( 'admin_notices', array( $this, 'onboarding_admin_notices' ) );
131131
}
132132

133-
/**
134-
* Callback for rendering the API Token settings field
135-
*/
136-
public function api_token_cb() {
137-
$api_token = get_option( self::OPTION_API_TOKEN );
138-
echo '<input type="password" class="regular-text" name="cloudflare_stream_api_token" id="cloudflare_stream_api_token" value="' . esc_attr( $api_token ) . '" autocomplete="off">'
139-
. '<small class="form-text text-muted">'
140-
. esc_html__( 'Cloudflare > My Profile > API Tokens > API Tokens > [Create Token]', 'cloudflare-stream-wordpress' ) . '</small>'
141-
. '<small class="form-text text-muted">' . esc_html__( 'Must have permission for: Account - Stream:Edit', 'cloudflare-stream-wordpress' ) . '</small>';
142-
}
143-
144133
/**
145134
* Callback for rendering the API Account ID settings field
146135
*/
@@ -153,6 +142,17 @@ public function api_account_cb() {
153142
. '<small class="form-text text-muted">' . esc_html__( 'Cloudflare > [domain] > Overview > [scroll down to API section on the right and copy the Account ID].', 'cloudflare-stream-wordpress' ) . '</small>';
154143
}
155144

145+
/**
146+
* Callback for rendering the API Token settings field
147+
*/
148+
public function api_token_cb() {
149+
$api_token = get_option( self::OPTION_API_TOKEN );
150+
echo '<input type="password" class="regular-text" name="cloudflare_stream_api_token" id="cloudflare_stream_api_token" value="' . esc_attr( $api_token ) . '" autocomplete="off">'
151+
. '<small class="form-text text-muted">'
152+
. esc_html__( 'Cloudflare > My Profile > API Tokens > API Tokens > [Create Token]', 'cloudflare-stream-wordpress' ) . '</small>'
153+
. '<small class="form-text text-muted">' . esc_html__( 'Must have permission for: Account - Stream:Edit', 'cloudflare-stream-wordpress' ) . '</small>';
154+
}
155+
156156
/**
157157
* Callback for rendering the use signed URLs field
158158
*/

0 commit comments

Comments
 (0)