Skip to content

Commit

Permalink
Add support for array values.
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed May 13, 2018
1 parent 3492cda commit 4a3f4ba
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/css-vars/class-kirki-modules-css-vars.php
Expand Up @@ -81,7 +81,11 @@ public function the_style() {
if ( is_string( $args['css_var'] ) ) {
$args['css_var'] = array( $args['css_var'], '$' );
}
echo esc_attr( $args['css_var'][0] ) . ':' . esc_attr( str_replace( '$', Kirki_Values::get_value( $args['kirki_config'], $id ), $args['css_var'][1] ) ) . ';';
$val = Kirki_Values::get_value( $args['kirki_config'], $id );
if ( isset( $args['css_var'][2] ) && is_array( $val ) && isset( $val[ $args['css_var'][2] ] ) ) {
$val = $val[ $args['css_var'][2] ];
}
echo esc_attr( $args['css_var'][0] ) . ':' . esc_attr( str_replace( '$', $val, $args['css_var'][1] ) ) . ';';
}
echo '}';
echo '</style>';
Expand Down

1 comment on commit 4a3f4ba

@aristath
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1561

Please sign in to comment.