@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | * @param array $value The field's value. |
| 23 | 23 | */ |
| 24 | 24 | protected function process_output( $output, $value ) { |
| 25 | - $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; |
|
| 26 | - $output['element'] = ( isset( $output['element'] ) ) ? $output['element'] : 'body'; |
|
| 27 | - $output['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : ''; |
|
| 28 | - $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; |
|
| 25 | + $output[ 'media_query' ] = ( isset( $output[ 'media_query' ] ) ) ? $output[ 'media_query' ] : 'global'; |
|
| 26 | + $output[ 'element' ] = ( isset( $output[ 'element' ] ) ) ? $output[ 'element' ] : 'body'; |
|
| 27 | + $output[ 'prefix' ] = ( isset( $output[ 'prefix' ] ) ) ? $output[ 'prefix' ] : ''; |
|
| 28 | + $output[ 'suffix' ] = ( isset( $output[ 'suffix' ] ) ) ? $output[ 'suffix' ] : ''; |
|
| 29 | 29 | |
| 30 | 30 | $value = Kirki_Field_Typography::sanitize( $value ); |
| 31 | 31 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | foreach ( $properties as $property ) { |
| 48 | 48 | |
| 49 | 49 | // Early exit if the value is not in the defaults. |
| 50 | - if ( ! isset( $this->field['default'][ $property ] ) ) { |
|
| 50 | + if ( ! isset( $this->field[ 'default' ][ $property ] ) ) { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -57,39 +57,39 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Early exit if we use "choice" but not for this property. |
| 60 | - if ( isset( $output['choice'] ) && $output['choice'] !== $property ) { |
|
| 60 | + if ( isset( $output[ 'choice' ] ) && $output[ 'choice' ] !== $property ) { |
|
| 61 | 61 | continue; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // Take care of variants. |
| 65 | - if ( 'variant' === $property && isset( $value['variant'] ) && ! empty( $value['variant'] ) ) { |
|
| 65 | + if ( 'variant' === $property && isset( $value[ 'variant' ] ) && ! empty( $value[ 'variant' ] ) ) { |
|
| 66 | 66 | |
| 67 | 67 | // Get the font_weight. |
| 68 | - $font_weight = str_replace( 'italic', '', $value['variant'] ); |
|
| 68 | + $font_weight = str_replace( 'italic', '', $value[ 'variant' ] ); |
|
| 69 | 69 | $font_weight = ( in_array( $font_weight, array( '', 'regular' ), true ) ) ? '400' : $font_weight; |
| 70 | 70 | |
| 71 | 71 | // Is this italic? |
| 72 | - $is_italic = ( false !== strpos( $value['variant'], 'italic' ) ); |
|
| 73 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight; |
|
| 72 | + $is_italic = ( false !== strpos( $value[ 'variant' ], 'italic' ) ); |
|
| 73 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ 'font-weight' ] = $font_weight; |
|
| 74 | 74 | if ( $is_italic ) { |
| 75 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic'; |
|
| 75 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ 'font-style' ] = 'italic'; |
|
| 76 | 76 | } |
| 77 | 77 | continue; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $property_value = $this->process_property_value( $property, $value[ $property ] ); |
| 81 | 81 | if ( 'font-family' === $property ) { |
| 82 | - $value['font-backup'] = ( isset( $value['font-backup'] ) ) ? $value['font-backup'] : ''; |
|
| 82 | + $value[ 'font-backup' ] = ( isset( $value[ 'font-backup' ] ) ) ? $value[ 'font-backup' ] : ''; |
|
| 83 | 83 | $property_value = $this->process_property_value( |
| 84 | 84 | $property, array( |
| 85 | - $value['font-family'], |
|
| 86 | - $value['font-backup'], |
|
| 85 | + $value[ 'font-family' ], |
|
| 86 | + $value[ 'font-backup' ], |
|
| 87 | 87 | ) |
| 88 | 88 | ); |
| 89 | 89 | } |
| 90 | - $property = ( isset( $output['choice'] ) && isset( $output['property'] ) ) ? $output['property'] : $property; |
|
| 91 | - $property_value = ( is_array( $property_value ) && isset( $property_value[0] ) ) ? $property_value[0] : $property_value; |
|
| 92 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $property_value . $output['suffix']; |
|
| 90 | + $property = ( isset( $output[ 'choice' ] ) && isset( $output[ 'property' ] ) ) ? $output[ 'property' ] : $property; |
|
| 91 | + $property_value = ( is_array( $property_value ) && isset( $property_value[ 0 ] ) ) ? $property_value[ 0 ] : $property_value; |
|
| 92 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $property ] = $output[ 'prefix' ] . $property_value . $output[ 'suffix' ]; |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * @param array $value The field's value. |
| 23 | 23 | */ |
| 24 | 24 | protected function process_output( $output, $value ) { |
| 25 | - if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) { |
|
| 25 | + if ( ! isset( $output[ 'element' ] ) || ! isset( $output[ 'property' ] ) ) { |
|
| 26 | 26 | return; |
| 27 | 27 | } |
| 28 | 28 | $output = wp_parse_args( |
@@ -34,16 +34,16 @@ discard block |
||
| 34 | 34 | ) |
| 35 | 35 | ); |
| 36 | 36 | if ( is_array( $value ) ) { |
| 37 | - if ( isset( $output['choice'] ) && $output['choice'] ) { |
|
| 38 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value[ $output['choice'] ] ) . $output['units'] . $output['suffix']; |
|
| 37 | + if ( isset( $output[ 'choice' ] ) && $output[ 'choice' ] ) { |
|
| 38 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value[ $output[ 'choice' ] ] ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
| 39 | 39 | return; |
| 40 | 40 | } |
| 41 | - if ( isset( $value['url'] ) ) { |
|
| 42 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value['url'] ) . $output['units'] . $output['suffix']; |
|
| 41 | + if ( isset( $value[ 'url' ] ) ) { |
|
| 42 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value[ 'url' ] ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
| 43 | 43 | return; |
| 44 | 44 | } |
| 45 | 45 | return; |
| 46 | 46 | } |
| 47 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
| 47 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
| 48 | 48 | } |
| 49 | 49 | } |
@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | protected function get_path( $context = '' ) { |
| 53 | 53 | $upload_dir = wp_upload_dir(); |
| 54 | 54 | $paths = array( |
| 55 | - 'file' => wp_normalize_path( $upload_dir['basedir'] . '/kirki-css/styles.css' ), |
|
| 56 | - 'folder' => wp_normalize_path( $upload_dir['basedir'] . '/kirki-css' ), |
|
| 55 | + 'file' => wp_normalize_path( $upload_dir[ 'basedir' ] . '/kirki-css/styles.css' ), |
|
| 56 | + 'folder' => wp_normalize_path( $upload_dir[ 'basedir' ] . '/kirki-css' ), |
|
| 57 | 57 | ); |
| 58 | 58 | |
| 59 | 59 | if ( 'file' === $context ) { |
| 60 | - return $paths['file']; |
|
| 60 | + return $paths[ 'file' ]; |
|
| 61 | 61 | } |
| 62 | 62 | if ( 'folder' === $context ) { |
| 63 | - return $paths['folder']; |
|
| 63 | + return $paths[ 'folder' ]; |
|
| 64 | 64 | } |
| 65 | 65 | return $paths; |
| 66 | 66 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function get_url() { |
| 76 | 76 | $upload_dir = wp_upload_dir(); |
| 77 | - return esc_url_raw( $upload_dir['baseurl'] . '/kirki-css/styles.css' ); |
|
| 77 | + return esc_url_raw( $upload_dir[ 'baseurl' ] . '/kirki-css/styles.css' ); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -77,15 +77,15 @@ discard block |
||
| 77 | 77 | echo '<style id="kirki-css-vars">'; |
| 78 | 78 | echo ':root{'; |
| 79 | 79 | foreach ( $fields as $id => $args ) { |
| 80 | - if ( ! isset( $args['css_vars'] ) || empty( $args['css_vars'] ) ) { |
|
| 80 | + if ( ! isset( $args[ 'css_vars' ] ) || empty( $args[ 'css_vars' ] ) ) { |
|
| 81 | 81 | continue; |
| 82 | 82 | } |
| 83 | - $val = Kirki_Values::get_value( $args['kirki_config'], $id ); |
|
| 84 | - foreach ( $args['css_vars'] as $css_var ) { |
|
| 85 | - if ( isset( $css_var[2] ) && is_array( $val ) && isset( $val[ $css_var[2] ] ) ) { |
|
| 86 | - echo esc_html( $css_var[0] ) . ':' . esc_html( str_replace( '$', $val[ $css_var[2] ], $css_var[1] ) ) . ';'; |
|
| 83 | + $val = Kirki_Values::get_value( $args[ 'kirki_config' ], $id ); |
|
| 84 | + foreach ( $args[ 'css_vars' ] as $css_var ) { |
|
| 85 | + if ( isset( $css_var[ 2 ] ) && is_array( $val ) && isset( $val[ $css_var[ 2 ] ] ) ) { |
|
| 86 | + echo esc_html( $css_var[ 0 ] ) . ':' . esc_html( str_replace( '$', $val[ $css_var[ 2 ] ], $css_var[ 1 ] ) ) . ';'; |
|
| 87 | 87 | } else { |
| 88 | - echo esc_html( $css_var[0] ) . ':' . esc_html( str_replace( '$', $val, $css_var[1] ) ) . ';'; |
|
| 88 | + echo esc_html( $css_var[ 0 ] ) . ':' . esc_html( str_replace( '$', $val, $css_var[ 1 ] ) ) . ';'; |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | $fields = Kirki::$fields; |
| 108 | 108 | $data = array(); |
| 109 | 109 | foreach ( $fields as $field ) { |
| 110 | - if ( isset( $field['transport'] ) && 'postMessage' === $field['transport'] && isset( $field['css_vars'] ) && ! empty( $field['css_vars'] ) ) { |
|
| 111 | - $data[] = $field; |
|
| 110 | + if ( isset( $field[ 'transport' ] ) && 'postMessage' === $field[ 'transport' ] && isset( $field[ 'css_vars' ] ) && ! empty( $field[ 'css_vars' ] ) ) { |
|
| 111 | + $data[ ] = $field; |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | wp_localize_script( 'kirki_auto_css_vars', 'kirkiCssVarFields', $data ); |
@@ -52,15 +52,15 @@ |
||
| 52 | 52 | ) |
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | - $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 56 | - $array['content'] = $this->get_content(); |
|
| 57 | - $array['active'] = $this->active(); |
|
| 58 | - $array['instanceNumber'] = $this->instance_number; |
|
| 55 | + $array[ 'title' ] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 56 | + $array[ 'content' ] = $this->get_content(); |
|
| 57 | + $array[ 'active' ] = $this->active(); |
|
| 58 | + $array[ 'instanceNumber' ] = $this->instance_number; |
|
| 59 | 59 | |
| 60 | - $array['customizeAction'] = esc_html__( 'Customizing', 'kirki' ); |
|
| 60 | + $array[ 'customizeAction' ] = esc_html__( 'Customizing', 'kirki' ); |
|
| 61 | 61 | if ( $this->panel ) { |
| 62 | 62 | /* translators: The title. */ |
| 63 | - $array['customizeAction'] = sprintf( esc_html__( 'Customizing ▸ %s', 'kirki' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); |
|
| 63 | + $array[ 'customizeAction' ] = sprintf( esc_html__( 'Customizing ▸ %s', 'kirki' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); |
|
| 64 | 64 | } |
| 65 | 65 | return $array; |
| 66 | 66 | } |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function custom_css() { |
| 67 | 67 | $config = apply_filters( 'kirki_config', array() ); |
| 68 | - if ( ! isset( $config['color_accent'] ) && ! isset( $config['color_back'] ) ) { |
|
| 68 | + if ( ! isset( $config[ 'color_accent' ] ) && ! isset( $config[ 'color_back' ] ) ) { |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | - $back = isset( $config['color_back'] ) ? $config['color_back'] : false; |
|
| 71 | + $back = isset( $config[ 'color_back' ] ) ? $config[ 'color_back' ] : false; |
|
| 72 | 72 | |
| 73 | 73 | $text_on_back = ''; |
| 74 | 74 | $border_on_back = ''; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $hover_on_back = ( 90 < $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness - 3 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness + 3 )->toCSS( $back_obj->mode ); |
| 91 | 91 | $arrows_on_back = ( 50 > $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness + 30 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness - 30 )->toCSS( $back_obj->mode ); |
| 92 | 92 | } |
| 93 | - $accent = ( isset( $config['color_accent'] ) ) ? $config['color_accent'] : false; |
|
| 93 | + $accent = ( isset( $config[ 'color_accent' ] ) ) ? $config[ 'color_accent' ] : false; |
|
| 94 | 94 | if ( $accent ) { |
| 95 | 95 | $accent_obj = ariColor::newColor( $accent ); |
| 96 | 96 | $text_on_accent = ( 60 > $accent_obj->lightness ) ? $accent_obj->getNew( 'lightness', $accent_obj->lightness + 60 )->toCSS( $accent_obj->mode ) : $accent_obj->getNew( 'lightness', $accent_obj->lightness - 60 )->toCSS( $accent_obj->mode ); |
@@ -402,18 +402,18 @@ discard block |
||
| 402 | 402 | color: #444 !important; |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | - <?php if ( isset( $config['width'] ) ) : ?> |
|
| 405 | + <?php if ( isset( $config[ 'width' ] ) ) : ?> |
|
| 406 | 406 | .wp-full-overlay-sidebar { |
| 407 | - width: <?php echo esc_html( $config['width'] ); ?>; |
|
| 407 | + width: <?php echo esc_html( $config[ 'width' ] ); ?>; |
|
| 408 | 408 | } |
| 409 | 409 | .expanded .wp-full-overlay-footer { |
| 410 | - width: <?php echo esc_html( $config['width'] ); ?>; |
|
| 410 | + width: <?php echo esc_html( $config[ 'width' ] ); ?>; |
|
| 411 | 411 | } |
| 412 | 412 | .wp-full-overlay.expanded { |
| 413 | - margin-left: <?php echo esc_html( $config['width'] ); ?>; |
|
| 413 | + margin-left: <?php echo esc_html( $config[ 'width' ] ); ?>; |
|
| 414 | 414 | } |
| 415 | 415 | .wp-full-overlay.collapsed .wp-full-overlay-sidebar { |
| 416 | - margin-left: -<?php echo esc_html( $config['width'] ); ?>; |
|
| 416 | + margin-left: -<?php echo esc_html( $config[ 'width' ] ); ?>; |
|
| 417 | 417 | } |
| 418 | 418 | <?php endif; ?> |
| 419 | 419 | </style> |
@@ -75,13 +75,13 @@ |
||
| 75 | 75 | private function parse_fields() { |
| 76 | 76 | $fields = Kirki::$fields; |
| 77 | 77 | foreach ( $fields as $field ) { |
| 78 | - if ( isset( $field['tooltip'] ) && ! empty( $field['tooltip'] ) ) { |
|
| 78 | + if ( isset( $field[ 'tooltip' ] ) && ! empty( $field[ 'tooltip' ] ) ) { |
|
| 79 | 79 | // Get the control ID and properly format it for the tooltips. |
| 80 | - $id = str_replace( '[', '-', str_replace( ']', '', $field['settings'] ) ); |
|
| 80 | + $id = str_replace( '[', '-', str_replace( ']', '', $field[ 'settings' ] ) ); |
|
| 81 | 81 | // Add the tooltips content. |
| 82 | 82 | $this->tooltips_content[ $id ] = array( |
| 83 | 83 | 'id' => $id, |
| 84 | - 'content' => $field['tooltip'], |
|
| 84 | + 'content' => $field[ 'tooltip' ], |
|
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function to_json() { |
| 36 | 36 | parent::to_json(); |
| 37 | - $this->json['icons'] = Kirki_Helper::get_dashicons(); |
|
| 37 | + $this->json[ 'icons' ] = Kirki_Helper::get_dashicons(); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -83,28 +83,28 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | if ( empty( $this->button_label ) ) { |
| 85 | 85 | /* translators: %s represents the label of the row. */ |
| 86 | - $this->button_label = sprintf( esc_html__( 'Add new %s', 'kirki' ), $this->row_label['value'] ); |
|
| 86 | + $this->button_label = sprintf( esc_html__( 'Add new %s', 'kirki' ), $this->row_label[ 'value' ] ); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if ( empty( $args['fields'] ) || ! is_array( $args['fields'] ) ) { |
|
| 90 | - $args['fields'] = array(); |
|
| 89 | + if ( empty( $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) { |
|
| 90 | + $args[ 'fields' ] = array(); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | // An array to store keys of fields that need to be filtered. |
| 94 | 94 | $media_fields_to_filter = array(); |
| 95 | 95 | |
| 96 | - foreach ( $args['fields'] as $key => $value ) { |
|
| 97 | - if ( ! isset( $value['default'] ) ) { |
|
| 98 | - $args['fields'][ $key ]['default'] = ''; |
|
| 96 | + foreach ( $args[ 'fields' ] as $key => $value ) { |
|
| 97 | + if ( ! isset( $value[ 'default' ] ) ) { |
|
| 98 | + $args[ 'fields' ][ $key ][ 'default' ] = ''; |
|
| 99 | 99 | } |
| 100 | - if ( ! isset( $value['label'] ) ) { |
|
| 101 | - $args['fields'][ $key ]['label'] = ''; |
|
| 100 | + if ( ! isset( $value[ 'label' ] ) ) { |
|
| 101 | + $args[ 'fields' ][ $key ][ 'label' ] = ''; |
|
| 102 | 102 | } |
| 103 | - $args['fields'][ $key ]['id'] = $key; |
|
| 103 | + $args[ 'fields' ][ $key ][ 'id' ] = $key; |
|
| 104 | 104 | |
| 105 | 105 | // We check if the filed is an uploaded media ( image , file, video, etc.. ). |
| 106 | - if ( isset( $value['type'] ) ) { |
|
| 107 | - switch ( $value['type'] ) { |
|
| 106 | + if ( isset( $value[ 'type' ] ) ) { |
|
| 107 | + switch ( $value[ 'type' ] ) { |
|
| 108 | 108 | case 'image': |
| 109 | 109 | case 'cropped_image': |
| 110 | 110 | case 'upload': |
@@ -127,14 +127,14 @@ discard block |
||
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | 129 | // Hackily add in the data link parameter. |
| 130 | - $dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][ $key ]['id'] ) . '"' . $this->get_link(), $dropdown ); // phpcs:ignore Generic.Formatting.MultipleStatementAlignment.NotSameWarning |
|
| 131 | - $args['fields'][ $key ]['dropdown'] = $dropdown; |
|
| 130 | + $dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args[ 'fields' ][ $key ][ 'id' ] ) . '"' . $this->get_link(), $dropdown ); // phpcs:ignore Generic.Formatting.MultipleStatementAlignment.NotSameWarning |
|
| 131 | + $args[ 'fields' ][ $key ][ 'dropdown' ] = $dropdown; |
|
| 132 | 132 | break; |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - $this->fields = $args['fields']; |
|
| 137 | + $this->fields = $args[ 'fields' ]; |
|
| 138 | 138 | |
| 139 | 139 | // Now we are going to filter the fields. |
| 140 | 140 | // First we create a copy of the value that would be used otherwise. |
@@ -194,14 +194,14 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | $fields = $this->fields; |
| 196 | 196 | |
| 197 | - $this->json['fields'] = $fields; |
|
| 198 | - $this->json['row_label'] = $this->row_label; |
|
| 197 | + $this->json[ 'fields' ] = $fields; |
|
| 198 | + $this->json[ 'row_label' ] = $this->row_label; |
|
| 199 | 199 | |
| 200 | 200 | // If filtered_value has been set and is not empty we use it instead of the actual value. |
| 201 | 201 | if ( is_array( $this->filtered_value ) && ! empty( $this->filtered_value ) ) { |
| 202 | - $this->json['value'] = $this->filtered_value; |
|
| 202 | + $this->json[ 'value' ] = $this->filtered_value; |
|
| 203 | 203 | } |
| 204 | - $this->json['value'] = apply_filters( "kirki_controls_repeater_value_{$this->id}", $this->json['value'] ); |
|
| 204 | + $this->json[ 'value' ] = apply_filters( "kirki_controls_repeater_value_{$this->id}", $this->json[ 'value' ] ); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -224,9 +224,9 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | <ul class="repeater-fields"></ul> |
| 226 | 226 | |
| 227 | - <?php if ( isset( $this->choices['limit'] ) ) : ?> |
|
| 227 | + <?php if ( isset( $this->choices[ 'limit' ] ) ) : ?> |
|
| 228 | 228 | <?php /* translators: %s represents the number of rows we're limiting the repeater to allow. */ ?> |
| 229 | - <p class="limit"><?php printf( esc_html__( 'Limit: %s rows', 'kirki' ), esc_html( $this->choices['limit'] ) ); ?></p> |
|
| 229 | + <p class="limit"><?php printf( esc_html__( 'Limit: %s rows', 'kirki' ), esc_html( $this->choices[ 'limit' ] ) ); ?></p> |
|
| 230 | 230 | <?php endif; ?> |
| 231 | 231 | <button class="button-secondary repeater-add"><?php echo esc_html( $this->button_label ); ?></button> |
| 232 | 232 | |
@@ -459,24 +459,24 @@ discard block |
||
| 459 | 459 | protected function row_label( $args ) { |
| 460 | 460 | |
| 461 | 461 | // Validating args for row labels. |
| 462 | - if ( isset( $args['row_label'] ) && is_array( $args['row_label'] ) && ! empty( $args['row_label'] ) ) { |
|
| 462 | + if ( isset( $args[ 'row_label' ] ) && is_array( $args[ 'row_label' ] ) && ! empty( $args[ 'row_label' ] ) ) { |
|
| 463 | 463 | |
| 464 | 464 | // Validating row label type. |
| 465 | - if ( isset( $args['row_label']['type'] ) && ( 'text' === $args['row_label']['type'] || 'field' === $args['row_label']['type'] ) ) { |
|
| 466 | - $this->row_label['type'] = $args['row_label']['type']; |
|
| 465 | + if ( isset( $args[ 'row_label' ][ 'type' ] ) && ( 'text' === $args[ 'row_label' ][ 'type' ] || 'field' === $args[ 'row_label' ][ 'type' ] ) ) { |
|
| 466 | + $this->row_label[ 'type' ] = $args[ 'row_label' ][ 'type' ]; |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | // Validating row label type. |
| 470 | - if ( isset( $args['row_label']['value'] ) && ! empty( $args['row_label']['value'] ) ) { |
|
| 471 | - $this->row_label['value'] = esc_html( $args['row_label']['value'] ); |
|
| 470 | + if ( isset( $args[ 'row_label' ][ 'value' ] ) && ! empty( $args[ 'row_label' ][ 'value' ] ) ) { |
|
| 471 | + $this->row_label[ 'value' ] = esc_html( $args[ 'row_label' ][ 'value' ] ); |
|
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | // Validating row label field. |
| 475 | - if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][ sanitize_key( $args['row_label']['field'] ) ] ) ) { |
|
| 476 | - $this->row_label['field'] = esc_html( $args['row_label']['field'] ); |
|
| 475 | + if ( isset( $args[ 'row_label' ][ 'field' ] ) && ! empty( $args[ 'row_label' ][ 'field' ] ) && isset( $args[ 'fields' ][ sanitize_key( $args[ 'row_label' ][ 'field' ] ) ] ) ) { |
|
| 476 | + $this->row_label[ 'field' ] = esc_html( $args[ 'row_label' ][ 'field' ] ); |
|
| 477 | 477 | } else { |
| 478 | 478 | // If from field is not set correctly, making sure standard is set as the type. |
| 479 | - $this->row_label['type'] = 'text'; |
|
| 479 | + $this->row_label[ 'type' ] = 'text'; |
|
| 480 | 480 | } |
| 481 | 481 | } |
| 482 | 482 | } |