Skip to content

Commit

Permalink
Allow defining a style for the label on radio-image controls
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Dec 18, 2016
1 parent ab64922 commit cf16ccb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions controls/radio-image/class-kirki-control-radio-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ public function to_json() {
}

$this->json['inputAttrs'] = '';
$this->json['labelStyle'] = '';
foreach ( $this->input_attrs as $attr => $value ) {
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
if ( 'style' !== $attr ) {
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
} else {
$this->json['labelStyle'] = 'style="' . esc_attr( $value ) . '" ';
}
}

}
Expand Down Expand Up @@ -124,7 +129,7 @@ protected function content_template() {
<div id="input_{{ data.id }}" class="image">
<# for ( key in data.choices ) { #>
<input {{{ data.inputAttrs }}} class="image-select" type="radio" value="{{ key }}" name="_customize-radio-{{ data.id }}" id="{{ data.id }}{{ key }}" {{{ data.link }}}<# if ( data.value === key ) { #> checked="checked"<# } #>>
<label for="{{ data.id }}{{ key }}">
<label for="{{ data.id }}{{ key }}" {{{ data.labelStyle }}}>
<img src="{{ data.choices[ key ] }}">
<span class="image-clickable"></span>
</label>
Expand Down

0 comments on commit cf16ccb

Please sign in to comment.