@@ -148,6 +148,9 @@ public static function _renderJsonScreen( $args ) {
148
148
$ headers ['method ' ] = 'get ' ;
149
149
}
150
150
$ methods = apply_filters ( 'visualizer_json_request_methods ' , array ( 'GET ' , 'POST ' ) );
151
+
152
+ // open the headers by default?
153
+ $ headers_open = $ headers && array_key_exists ( 'auth ' , $ headers ) && ( array_key_exists ( 'username ' , $ headers ['auth ' ] ) && ! empty ( $ headers ['auth ' ]['username ' ] ) ) || ( ! empty ( $ headers ['auth ' ] ) && is_string ( $ headers ['auth ' ] ) );
151
154
?>
152
155
<div id="visualizer-json-screen" style="display: none">
153
156
<div class="visualizer-json-form">
@@ -170,7 +173,7 @@ class="visualizer-input json-form-element">
170
173
<button class="button button-secondary button-small" id="visualizer-json-fetch"><?php esc_html_e ( 'Fetch Endpoint ' , 'visualizer ' ); ?> </button>
171
174
172
175
<div class="visualizer-json-subform">
173
- <h3 class="viz-substep"><?php _e ( 'Headers ' , 'visualizer ' ); ?> </h3>
176
+ <h3 class="viz-substep <?php echo $ headers_open ? ' open ' : '' ; ?> "><?php _e ( 'Headers ' , 'visualizer ' ); ?> </h3>
174
177
<div class="json-wizard-headers">
175
178
<div class="json-wizard-header">
176
179
<div><?php _e ( 'Request Type ' , 'visualizer ' ); ?> </div>
@@ -213,7 +216,7 @@ class="json-form-element">
213
216
type="text"
214
217
id="vz-import-json-auth"
215
218
name="auth"
216
- value="<?php echo ( ! empty ( $ headers ) && array_key_exists ( 'auth ' , $ headers ) ? $ headers[ ' auth ' ] ['auth ' ] : '' ); ?> "
219
+ value="<?php echo ( array_key_exists ( ' auth ' , $ headers ) && is_string ( $ headers [ 'auth ' ] ) ? $ headers ['auth ' ] : '' ); ?> "
217
220
placeholder="<?php esc_html_e ( 'e.g. SharedKey <AccountName>:<Signature> ' , 'visualizer ' ); ?> "
218
221
class="visualizer-input json-form-element">
219
222
</div>
0 commit comments