Completed
Pull Request — trunk (#848)
by
unknown
04:35
created
includes/types/CMB2_Type_Radio.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 	}
47 47
 
48 48
 	protected function ul( $a ) {
49
-		return sprintf( '<ul class="%s">%s</ul>%s', $a['class'], $a['options'], $a['desc'] );
49
+		return sprintf( '<ul class="%s">%s</ul>%s', $a[ 'class' ], $a[ 'options' ], $a[ 'desc' ] );
50 50
 	}
51 51
 
52 52
 }
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Textarea_Code.php 1 patch
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 	/**
16 16
 	 * Handles outputting a 'wysiwyg' element
17 17
 	 * @since  1.1.0
18
-	 * @param  array  $args Override arguments
19 18
 	 * @return string       Form wysiwyg element
20 19
 	 */
21 20
 	public function render() {
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Multi_Base.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * @return string       Generated option element html
20 20
 	 */
21 21
 	public function select_option( $args = array() ) {
22
-		return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args['value'], selected( isset( $args['checked'] ) && $args['checked'], true, false ), $args['label'] ) . "\n";
22
+		return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args[ 'value' ], selected( isset( $args[ 'checked' ] ) && $args[ 'checked' ], true, false ), $args[ 'label' ] ) . "\n";
23 23
 	}
24 24
 
25 25
 	/**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 			'label' => '',
40 40
 		), $args );
41 41
 
42
-		return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a['id'], $a['label'] );
42
+		return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a[ 'id' ], $a[ 'label' ] );
43 43
 	}
44 44
 
45 45
 	/**
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function list_input_checkbox( $args, $i ) {
53 53
 		$saved_value = $this->field->escaped_value();
54
-		if ( is_array( $saved_value ) && in_array( $args['value'], $saved_value ) ) {
55
-			$args['checked'] = 'checked';
54
+		if ( is_array( $saved_value ) && in_array( $args[ 'value' ], $saved_value ) ) {
55
+			$args[ 'checked' ] = 'checked';
56 56
 		}
57
-		$args['type'] = 'checkbox';
57
+		$args[ 'type' ] = 'checkbox';
58 58
 		return $this->list_input( $args, $i );
59 59
 	}
60 60
 
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	public function concat_items( $args = array() ) {
68 68
 		$field = $this->field;
69 69
 
70
-		$method = isset( $args['method'] ) ? $args['method'] : 'select_option';
71
-		unset( $args['method'] );
70
+		$method = isset( $args[ 'method' ] ) ? $args[ 'method' ] : 'select_option';
71
+		unset( $args[ 'method' ] );
72 72
 
73 73
 		$value = $field->escaped_value()
74 74
 			? $field->escaped_value()
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 			// Clone args & modify for just this item
87 87
 			$a = $args;
88 88
 
89
-			$a['value'] = $opt_value;
90
-			$a['label'] = $opt_label;
89
+			$a[ 'value' ] = $opt_value;
90
+			$a[ 'label' ] = $opt_label;
91 91
 
92 92
 			// Check if this option is the value of the input
93 93
 			if ( $value == $opt_value ) {
94
-				$a['checked'] = 'checked';
94
+				$a[ 'checked' ] = 'checked';
95 95
 			}
96 96
 
97 97
 			$concatenated_items .= $this->$method( $a, $i++ );
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Select.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 		$attrs = $this->concat_attrs( $a, array( 'desc', 'options' ) );
25 25
 
26 26
 		return $this->rendered(
27
-			sprintf( '<select%s>%s</select>%s', $attrs, $a['options'], $a['desc'] )
27
+			sprintf( '<select%s>%s</select>%s', $attrs, $a[ 'options' ], $a[ 'desc' ] )
28 28
 		);
29 29
 	}
30 30
 }
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Textarea.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 		), $args );
32 32
 
33 33
 		return $this->rendered(
34
-			sprintf( '<textarea%s>%s</textarea>%s', $this->concat_attrs( $a, array( 'desc', 'value' ) ), $a['value'], $a['desc'] )
34
+			sprintf( '<textarea%s>%s</textarea>%s', $this->concat_attrs( $a, array( 'desc', 'value' ) ), $a[ 'value' ], $a[ 'desc' ] )
35 35
 		);
36 36
 	}
37 37
 }
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Text_Datetime_Timestamp_Timezone.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
 			'select_timezone'         => array(),
23 23
 		) );
24 24
 
25
-		$args['value'] = $field->escaped_value();
26
-		if ( is_array( $args['value'] ) ) {
27
-			$args['value'] = '';
25
+		$args[ 'value' ] = $field->escaped_value();
26
+		if ( is_array( $args[ 'value' ] ) ) {
27
+			$args[ 'value' ] = '';
28 28
 		}
29 29
 
30
-		$datetime = maybe_unserialize( $args['value'] );
30
+		$datetime = maybe_unserialize( $args[ 'value' ] );
31 31
 		$value = $tzstring = '';
32 32
 
33 33
 		if ( $datetime && $datetime instanceof DateTime ) {
@@ -36,19 +36,19 @@  discard block
 block discarded – undo
36 36
 			$value    = $datetime->getTimestamp();
37 37
 		}
38 38
 
39
-		$timestamp_args = wp_parse_args( $args['text_datetime_timestamp'], array(
39
+		$timestamp_args = wp_parse_args( $args[ 'text_datetime_timestamp' ], array(
40 40
 			'desc'     => '',
41 41
 			'value'    => $value,
42 42
 			'rendered' => true,
43 43
 		) );
44 44
 		$datetime_timestamp = $this->types->text_datetime_timestamp( $timestamp_args );
45 45
 
46
-		$timezone_select_args = wp_parse_args( $args['select_timezone'], array(
46
+		$timezone_select_args = wp_parse_args( $args[ 'select_timezone' ], array(
47 47
 			'class'    => 'cmb2_select cmb2-select-timezone',
48 48
 			'name'     => $this->_name( '[timezone]' ),
49 49
 			'id'       => $this->_id( '_timezone' ),
50 50
 			'options'  => wp_timezone_choice( $tzstring ),
51
-			'desc'     => $args['desc'],
51
+			'desc'     => $args[ 'desc' ],
52 52
 			'rendered' => true,
53 53
 		) );
54 54
 		$select = $this->types->select( $timezone_select_args );
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Base.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public function __construct( CMB2_Types $types, $args = array() ) {
40 40
 		$this->types = $types;
41
-		$args['rendered'] = isset( $args['rendered'] ) ? (bool) $args['rendered'] : true;
41
+		$args[ 'rendered' ] = isset( $args[ 'rendered' ] ) ? (bool) $args[ 'rendered' ] : true;
42 42
 		$this->args = $args;
43 43
 	}
44 44
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @return string|CMB2_Type_Base           Rendered output or this object.
57 57
 	 */
58 58
 	public function rendered( $rendered ) {
59
-		if ( $this->args['rendered'] ) {
59
+		if ( $this->args[ 'rendered' ] ) {
60 60
 			return is_a( $rendered, __CLASS__ ) ? $rendered->rendered : $rendered;
61 61
 		}
62 62
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	/**
53 53
 	 * Stores the rendered field output.
54 54
 	 * @since  2.2.2
55
-	 * @param  string|CMB2_Type_Base $rendered Rendered output.
55
+	 * @param  string $rendered Rendered output.
56 56
 	 * @return string|CMB2_Type_Base           Rendered output or this object.
57 57
 	 */
58 58
 	public function rendered( $rendered ) {
@@ -107,7 +107,6 @@  discard block
 block discarded – undo
107 107
 
108 108
 	/**
109 109
 	 * Fall back to CMB2_Types methods
110
-	 * @param string $field
111 110
 	 * @throws Exception Throws an exception if the field is invalid.
112 111
 	 * @return mixed
113 112
 	 */
@@ -128,7 +127,7 @@  discard block
 block discarded – undo
128 127
 	 * Magic getter for our object.
129 128
 	 * @param string $field
130 129
 	 * @throws Exception Throws an exception if the field is invalid.
131
-	 * @return mixed
130
+	 * @return CMB2_Field
132 131
 	 */
133 132
 	public function __get( $field ) {
134 133
 		switch ( $field ) {
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Text.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@
 block discarded – undo
50 50
 			'js_dependencies' => array(),
51 51
 		), $args );
52 52
 
53
-		if ( ! empty( $a['js_dependencies'] ) ) {
54
-			$this->field->add_js_dependencies( $a['js_dependencies'] );
53
+		if ( ! empty( $a[ 'js_dependencies' ] ) ) {
54
+			$this->field->add_js_dependencies( $a[ 'js_dependencies' ] );
55 55
 		}
56 56
 
57 57
 		return $this->rendered(
58
-			sprintf( '<input%s/>%s', $this->concat_attrs( $a, array( 'desc', 'js_dependencies' ) ), $a['desc'] )
58
+			sprintf( '<input%s/>%s', $this->concat_attrs( $a, array( 'desc', 'js_dependencies' ) ), $a[ 'desc' ] )
59 59
 		);
60 60
 	}
61 61
 }
Please login to merge, or discard this patch.
includes/CMB2_Field.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 	 * Return a formatted timestamp for a field
736 736
 	 * @since  2.0.0
737 737
 	 * @param  string $format     Either date_format or time_format
738
-	 * @param  string $meta_value Optional meta value to check
738
+	 * @param  integer $meta_value Optional meta value to check
739 739
 	 * @return string             Formatted date
740 740
 	 */
741 741
 	public function get_timestamp_format( $format = 'date_format', $meta_value = 0 ) {
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 	 * Retrieve options args. Calls options_cb if it exists.
1008 1008
 	 * @since  2.0.0
1009 1009
 	 * @param  string  $key Specific option to retrieve
1010
-	 * @return array        Array of options
1010
+	 * @return string        Array of options
1011 1011
 	 */
1012 1012
 	public function options( $key = '' ) {
1013 1013
 		if ( ! empty( $this->field_options ) ) {
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -112,21 +112,21 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function __construct( $args ) {
114 114
 
115
-		if ( ! empty( $args['group_field'] ) ) {
116
-			$this->group       = $args['group_field'];
115
+		if ( ! empty( $args[ 'group_field' ] ) ) {
116
+			$this->group       = $args[ 'group_field' ];
117 117
 			$this->object_id   = $this->group->object_id;
118 118
 			$this->object_type = $this->group->object_type;
119 119
 			$this->cmb_id      = $this->group->cmb_id;
120 120
 		} else {
121
-			$this->object_id   = isset( $args['object_id'] ) && '_' !== $args['object_id'] ? $args['object_id'] : 0;
122
-			$this->object_type = isset( $args['object_type'] ) ? $args['object_type'] : 'post';
121
+			$this->object_id   = isset( $args[ 'object_id' ] ) && '_' !== $args[ 'object_id' ] ? $args[ 'object_id' ] : 0;
122
+			$this->object_type = isset( $args[ 'object_type' ] ) ? $args[ 'object_type' ] : 'post';
123 123
 
124
-			if ( isset( $args['cmb_id'] ) ) {
125
-				$this->cmb_id = $args['cmb_id'];
124
+			if ( isset( $args[ 'cmb_id' ] ) ) {
125
+				$this->cmb_id = $args[ 'cmb_id' ];
126 126
 			}
127 127
 		}
128 128
 
129
-		$this->args = $this->_set_field_defaults( $args['field_args'], $args );
129
+		$this->args = $this->_set_field_defaults( $args[ 'field_args' ], $args );
130 130
 
131 131
 		if ( $this->object_id ) {
132 132
 			$this->value = $this->get_data();
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			return call_user_func_array( array( $this, 'get_string' ), $arguments );
146 146
 		}
147 147
 
148
-		$key = isset( $arguments[0] ) ? $arguments[0] : false;
148
+		$key = isset( $arguments[ 0 ] ) ? $arguments[ 0 ] : false;
149 149
 		return $this->args( $name, $key );
150 150
 	}
151 151
 
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function get_data( $field_id = '', $args = array() ) {
218 218
 		if ( $field_id ) {
219
-			$args['field_id'] = $field_id;
219
+			$args[ 'field_id' ] = $field_id;
220 220
 		} else if ( $this->group ) {
221
-			$args['field_id'] = $this->group->id();
221
+			$args[ 'field_id' ] = $this->group->id();
222 222
 		}
223 223
 
224 224
 		$a = $this->data_args( $args );
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 		 *
260 260
 		 * @since 2.0.0
261 261
 		 */
262
-		$data = apply_filters( "cmb2_override_{$a['field_id']}_meta_value", $data, $this->object_id, $a, $this );
262
+		$data = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_value", $data, $this->object_id, $a, $this );
263 263
 
264 264
 		// If no override, get value normally
265 265
 		if ( 'cmb2_field_no_override_val' === $data ) {
266
-			$data = 'options-page' === $a['type']
267
-				? cmb2_options( $a['id'] )->get( $a['field_id'] )
268
-				: get_metadata( $a['type'], $a['id'], $a['field_id'], ( $a['single'] || $a['repeat'] ) );
266
+			$data = 'options-page' === $a[ 'type' ]
267
+				? cmb2_options( $a[ 'id' ] )->get( $a[ 'field_id' ] )
268
+				: get_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], ( $a[ 'single' ] || $a[ 'repeat' ] ) );
269 269
 		}
270 270
 
271 271
 		if ( $this->group ) {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	public function update_data( $new_value, $single = true ) {
288 288
 		$a = $this->data_args( array( 'single' => $single ) );
289 289
 
290
-		$a['value'] = $a['repeat'] ? array_values( $new_value ) : $new_value;
290
+		$a[ 'value' ] = $a[ 'repeat' ] ? array_values( $new_value ) : $new_value;
291 291
 
292 292
 		/**
293 293
 		 * Filter whether to override saving of meta value.
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		 *
324 324
 		 * @since 2.0.0
325 325
 		 */
326
-		$override = apply_filters( "cmb2_override_{$a['field_id']}_meta_save", $override, $a, $this->args(), $this );
326
+		$override = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_save", $override, $a, $this->args(), $this );
327 327
 
328 328
 		// If override, return that
329 329
 		if ( null !== $override ) {
@@ -331,22 +331,22 @@  discard block
 block discarded – undo
331 331
 		}
332 332
 
333 333
 		// Options page handling (or temp data store)
334
-		if ( 'options-page' === $a['type'] || empty( $a['id'] ) ) {
335
-			return cmb2_options( $a['id'] )->update( $a['field_id'], $a['value'], false, $a['single'] );
334
+		if ( 'options-page' === $a[ 'type' ] || empty( $a[ 'id' ] ) ) {
335
+			return cmb2_options( $a[ 'id' ] )->update( $a[ 'field_id' ], $a[ 'value' ], false, $a[ 'single' ] );
336 336
 		}
337 337
 
338 338
 		// Add metadata if not single
339
-		if ( ! $a['single'] ) {
340
-			return add_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'], false );
339
+		if ( ! $a[ 'single' ] ) {
340
+			return add_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $a[ 'value' ], false );
341 341
 		}
342 342
 
343 343
 		// Delete meta if we have an empty array
344
-		if ( is_array( $a['value'] ) && empty( $a['value'] ) ) {
345
-			return delete_metadata( $a['type'], $a['id'], $a['field_id'], $this->value );
344
+		if ( is_array( $a[ 'value' ] ) && empty( $a[ 'value' ] ) ) {
345
+			return delete_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $this->value );
346 346
 		}
347 347
 
348 348
 		// Update metadata
349
-		return update_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'] );
349
+		return update_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $a[ 'value' ] );
350 350
 	}
351 351
 
352 352
 	/**
@@ -396,19 +396,19 @@  discard block
 block discarded – undo
396 396
 		 * @param array $field_args All field arguments
397 397
 		 * @param CMB2_Field object $field This field object
398 398
 		 */
399
-		$override = apply_filters( "cmb2_override_{$a['field_id']}_meta_remove", $override, $a, $this->args(), $this );
399
+		$override = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_remove", $override, $a, $this->args(), $this );
400 400
 
401 401
 		// If no override, remove as usual
402 402
 		if ( null !== $override ) {
403 403
 			return $override;
404 404
 		}
405 405
 		// Option page handling
406
-		elseif ( 'options-page' === $a['type'] || empty( $a['id'] ) ) {
407
-			return cmb2_options( $a['id'] )->remove( $a['field_id'] );
406
+		elseif ( 'options-page' === $a[ 'type' ] || empty( $a[ 'id' ] ) ) {
407
+			return cmb2_options( $a[ 'id' ] )->remove( $a[ 'field_id' ] );
408 408
 		}
409 409
 
410 410
 		// Remove metadata
411
-		return delete_metadata( $a['type'], $a['id'], $a['field_id'], $old );
411
+		return delete_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $old );
412 412
 	}
413 413
 
414 414
 	/**
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 
860 860
 		foreach ( $conditional_classes as $class => $condition ) {
861 861
 			if ( $condition ) {
862
-				$classes[] = $class;
862
+				$classes[ ] = $class;
863 863
 			}
864 864
 		}
865 865
 
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 		}
871 871
 
872 872
 		if ( $added_classes ) {
873
-			$classes[] = esc_attr( $added_classes );
873
+			$classes[ ] = esc_attr( $added_classes );
874 874
 		}
875 875
 
876 876
 		/**
@@ -970,10 +970,10 @@  discard block
 block discarded – undo
970 970
 	public function get_string( $text_key, $fallback ) {
971 971
 		// If null, populate with our field strings values.
972 972
 		if ( null === $this->strings ) {
973
-			$this->strings = (array) $this->args['text'];
973
+			$this->strings = (array) $this->args[ 'text' ];
974 974
 
975
-			if ( is_callable( $this->args['text_cb'] ) ) {
976
-				$strings = call_user_func( $this->args['text_cb'], $this );
975
+			if ( is_callable( $this->args[ 'text_cb' ] ) ) {
976
+				$strings = call_user_func( $this->args[ 'text_cb' ], $this );
977 977
 
978 978
 				if ( $strings && is_array( $strings ) ) {
979 979
 					$this->strings += $strings;
@@ -1007,10 +1007,10 @@  discard block
 block discarded – undo
1007 1007
 			return $this->field_options;
1008 1008
 		}
1009 1009
 
1010
-		$this->field_options = (array) $this->args['options'];
1010
+		$this->field_options = (array) $this->args[ 'options' ];
1011 1011
 
1012
-		if ( is_callable( $this->args['options_cb'] ) ) {
1013
-			$options = call_user_func( $this->args['options_cb'], $this );
1012
+		if ( is_callable( $this->args[ 'options_cb' ] ) ) {
1013
+			$options = call_user_func( $this->args[ 'options_cb' ], $this );
1014 1014
 
1015 1015
 			if ( $options && is_array( $options ) ) {
1016 1016
 				$this->field_options = $options + $this->field_options;
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 	 */
1032 1032
 	public function add_js_dependencies( $dependencies = array() ) {
1033 1033
 		foreach ( (array) $dependencies as $dependency ) {
1034
-			$this->args['js_dependencies'][ $dependency ] = $dependency;
1034
+			$this->args[ 'js_dependencies' ][ $dependency ] = $dependency;
1035 1035
 		}
1036 1036
 
1037 1037
 		CMB2_JS::add_dependencies( $dependencies );
@@ -1045,17 +1045,17 @@  discard block
 block discarded – undo
1045 1045
 	 * @return mixed  Default field value
1046 1046
 	 */
1047 1047
 	public function get_default() {
1048
-		if ( null !== $this->args['default'] ) {
1049
-			return $this->args['default'];
1048
+		if ( null !== $this->args[ 'default' ] ) {
1049
+			return $this->args[ 'default' ];
1050 1050
 		}
1051 1051
 
1052
-		$param = is_callable( $this->args['default_cb'] ) ? 'default_cb' : 'default';
1052
+		$param = is_callable( $this->args[ 'default_cb' ] ) ? 'default_cb' : 'default';
1053 1053
 		$default = $this->get_param_callback_result( $param );
1054 1054
 
1055 1055
 		// Allow a filter override of the default value
1056
-		$this->args['default'] = apply_filters( 'cmb2_default_filter', $default, $this );
1056
+		$this->args[ 'default' ] = apply_filters( 'cmb2_default_filter', $default, $this );
1057 1057
 
1058
-		return $this->args['default'];
1058
+		return $this->args[ 'default' ];
1059 1059
 	}
1060 1060
 
1061 1061
 	/**
@@ -1085,18 +1085,18 @@  discard block
 block discarded – undo
1085 1085
 			'classes_cb'        => '',
1086 1086
 			'select_all_button' => true,
1087 1087
 			'multiple'          => false,
1088
-			'repeatable'        => isset( $args['type'] ) && 'group' == $args['type'],
1088
+			'repeatable'        => isset( $args[ 'type' ] ) && 'group' == $args[ 'type' ],
1089 1089
 			'inline'            => false,
1090 1090
 			'on_front'          => true,
1091 1091
 			'show_names'        => true,
1092 1092
 			'save_field'        => true, // Will not save if false
1093 1093
 			'date_format'       => 'm\/d\/Y',
1094 1094
 			'time_format'       => 'h:i A',
1095
-			'description'       => isset( $args['desc'] ) ? $args['desc'] : '',
1096
-			'preview_size'      => 'file' == $args['type'] ? 'large' : 'thumbnail',
1095
+			'description'       => isset( $args[ 'desc' ] ) ? $args[ 'desc' ] : '',
1096
+			'preview_size'      => 'file' == $args[ 'type' ] ? 'large' : 'thumbnail',
1097 1097
 			'render_row_cb'     => array( $this, 'render_field_callback' ),
1098 1098
 			'display_cb'        => array( $this, 'display_value_callback' ),
1099
-			'label_cb'          => 'title' != $args['type'] ? array( $this, 'label' ) : '',
1099
+			'label_cb'          => 'title' != $args[ 'type' ] ? array( $this, 'label' ) : '',
1100 1100
 			'column'            => false,
1101 1101
 			'js_dependencies'   => array(),
1102 1102
 			'show_in_rest'      => null,
@@ -1111,44 +1111,44 @@  discard block
 block discarded – undo
1111 1111
 		 */
1112 1112
 		$args = $this->convert_deprecated_params( $args );
1113 1113
 
1114
-		$args['repeatable'] = $args['repeatable'] && ! $this->repeatable_exception( $args['type'] );
1115
-		$args['inline']     = $args['inline'] || false !== stripos( $args['type'], '_inline' );
1114
+		$args[ 'repeatable' ] = $args[ 'repeatable' ] && ! $this->repeatable_exception( $args[ 'type' ] );
1115
+		$args[ 'inline' ]     = $args[ 'inline' ] || false !== stripos( $args[ 'type' ], '_inline' );
1116 1116
 
1117
-		$args['options']    = 'group' == $args['type'] ? wp_parse_args( $args['options'], array(
1117
+		$args[ 'options' ]    = 'group' == $args[ 'type' ] ? wp_parse_args( $args[ 'options' ], array(
1118 1118
 			'add_button'    => esc_html__( 'Add Group', 'cmb2' ),
1119 1119
 			'remove_button' => esc_html__( 'Remove Group', 'cmb2' ),
1120
-		) ) : $args['options'];
1120
+		) ) : $args[ 'options' ];
1121 1121
 
1122
-		$args['_id']        = $args['id'];
1123
-		$args['_name']      = $args['id'];
1122
+		$args[ '_id' ]        = $args[ 'id' ];
1123
+		$args[ '_name' ]      = $args[ 'id' ];
1124 1124
 
1125 1125
 		if ( $this->group ) {
1126 1126
 
1127
-			$args['id']    = $this->group->args( 'id' ) . '_' . $this->group->index . '_' . $args['id'];
1128
-			$args['_name'] = $this->group->args( 'id' ) . '[' . $this->group->index . '][' . $args['_name'] . ']';
1127
+			$args[ 'id' ]    = $this->group->args( 'id' ) . '_' . $this->group->index . '_' . $args[ 'id' ];
1128
+			$args[ '_name' ] = $this->group->args( 'id' ) . '[' . $this->group->index . '][' . $args[ '_name' ] . ']';
1129 1129
 		}
1130 1130
 
1131
-		if ( 'wysiwyg' == $args['type'] ) {
1132
-			$args['id'] = strtolower( str_ireplace( '-', '_', $args['id'] ) );
1133
-			$args['options']['textarea_name'] = $args['_name'];
1131
+		if ( 'wysiwyg' == $args[ 'type' ] ) {
1132
+			$args[ 'id' ] = strtolower( str_ireplace( '-', '_', $args[ 'id' ] ) );
1133
+			$args[ 'options' ][ 'textarea_name' ] = $args[ '_name' ];
1134 1134
 		}
1135 1135
 
1136 1136
 		$option_types = apply_filters( 'cmb2_all_or_nothing_types', array( 'select', 'radio', 'radio_inline', 'taxonomy_select', 'taxonomy_radio', 'taxonomy_radio_inline' ), $this );
1137 1137
 
1138
-		if ( in_array( $args['type'], $option_types, true ) ) {
1138
+		if ( in_array( $args[ 'type' ], $option_types, true ) ) {
1139 1139
 
1140
-			$args['show_option_none'] = isset( $args['show_option_none'] ) ? $args['show_option_none'] : null;
1141
-			$args['show_option_none'] = true === $args['show_option_none'] ? esc_html__( 'None', 'cmb2' ) : $args['show_option_none'];
1140
+			$args[ 'show_option_none' ] = isset( $args[ 'show_option_none' ] ) ? $args[ 'show_option_none' ] : null;
1141
+			$args[ 'show_option_none' ] = true === $args[ 'show_option_none' ] ? esc_html__( 'None', 'cmb2' ) : $args[ 'show_option_none' ];
1142 1142
 
1143
-			if ( null === $args['show_option_none'] ) {
1144
-				$off_by_default = in_array( $args['type'], array( 'select', 'radio', 'radio_inline' ), true );
1145
-				$args['show_option_none'] = $off_by_default ? false : esc_html__( 'None', 'cmb2' );
1143
+			if ( null === $args[ 'show_option_none' ] ) {
1144
+				$off_by_default = in_array( $args[ 'type' ], array( 'select', 'radio', 'radio_inline' ), true );
1145
+				$args[ 'show_option_none' ] = $off_by_default ? false : esc_html__( 'None', 'cmb2' );
1146 1146
 			}
1147 1147
 
1148 1148
 		}
1149 1149
 
1150
-		$args['has_supporting_data'] = in_array(
1151
-			$args['type'],
1150
+		$args[ 'has_supporting_data' ] = in_array(
1151
+			$args[ 'type' ],
1152 1152
 			array(
1153 1153
 				// CMB2_Sanitize::_save_file_id_value()/CMB2_Sanitize::_get_group_file_value_array()
1154 1154
 				'file',
@@ -1171,10 +1171,10 @@  discard block
 block discarded – undo
1171 1171
 	protected function get_default_args( $field_args, $field_group = null ) {
1172 1172
 		$args = parent::get_default_args( array(), $this->group );
1173 1173
 
1174
-		if ( isset( $field_args['field_args'] ) ) {
1174
+		if ( isset( $field_args[ 'field_args' ] ) ) {
1175 1175
 			$args = wp_parse_args( $field_args, $args );
1176 1176
 		} else {
1177
-			$args['field_args'] = wp_parse_args( $field_args, $this->args );
1177
+			$args[ 'field_args' ] = wp_parse_args( $field_args, $this->args );
1178 1178
 		}
1179 1179
 
1180 1180
 		return $args;
@@ -1217,43 +1217,43 @@  discard block
 block discarded – undo
1217 1217
 	 */
1218 1218
 	protected function convert_deprecated_params( $args ) {
1219 1219
 
1220
-		if ( isset( $args['row_classes'] ) ) {
1220
+		if ( isset( $args[ 'row_classes' ] ) ) {
1221 1221
 
1222 1222
 			// We'll let this one be.
1223 1223
 			// $this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_PARAM, 'row_classes', 'classes' );
1224 1224
 
1225 1225
 			// row_classes param could be a callback. This is definitely deprecated.
1226
-			if ( is_callable( $args['row_classes'] ) ) {
1226
+			if ( is_callable( $args[ 'row_classes' ] ) ) {
1227 1227
 
1228 1228
 				$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'row_classes', 'classes_cb' );
1229 1229
 
1230
-				$args['classes_cb'] = $args['row_classes'];
1231
-				$args['classes'] = null;
1230
+				$args[ 'classes_cb' ] = $args[ 'row_classes' ];
1231
+				$args[ 'classes' ] = null;
1232 1232
 			} else {
1233 1233
 
1234
-				$args['classes'] = $args['row_classes'];
1234
+				$args[ 'classes' ] = $args[ 'row_classes' ];
1235 1235
 			}
1236 1236
 
1237
-			unset( $args['row_classes'] );
1237
+			unset( $args[ 'row_classes' ] );
1238 1238
 		}
1239 1239
 
1240 1240
 
1241 1241
 		// default param can be passed a callback as well
1242
-		if ( is_callable( $args['default'] ) ) {
1242
+		if ( is_callable( $args[ 'default' ] ) ) {
1243 1243
 
1244 1244
 			$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'default', 'default_cb' );
1245 1245
 
1246
-			$args['default_cb'] = $args['default'];
1247
-			$args['default'] = null;
1246
+			$args[ 'default_cb' ] = $args[ 'default' ];
1247
+			$args[ 'default' ] = null;
1248 1248
 		}
1249 1249
 
1250 1250
 		// options param can be passed a callback as well
1251
-		if ( is_callable( $args['options'] ) ) {
1251
+		if ( is_callable( $args[ 'options' ] ) ) {
1252 1252
 
1253 1253
 			$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'options', 'options_cb' );
1254 1254
 
1255
-			$args['options_cb'] = $args['options'];
1256
-			$args['options'] = array();
1255
+			$args[ 'options_cb' ] = $args[ 'options' ];
1256
+			$args[ 'options' ] = array();
1257 1257
 		}
1258 1258
 
1259 1259
 		return $args;
Please login to merge, or discard this patch.