Skip to content

Commit

Permalink
fixes #885
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Apr 19, 2016
1 parent 915d25c commit 508e9af
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
9 changes: 4 additions & 5 deletions includes/class-kirki-fonts-google.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,8 @@ private function create_link() {

// Are we force-loading all variants?
if ( true === self::$force_load_all_variants ) {

if ( isset( $this->fonts[ $font ]['variants'] ) ) {
$variants = $this->fonts[ $font ]['variants'];
if ( isset( $this->google_fonts[ $font ]['variants'] ) ) {
$variants = $this->google_fonts[ $font ]['variants'];
}
}
$variants = implode( ',', $variants );
Expand All @@ -316,8 +315,8 @@ private function create_link() {
// Are we force-loading all subsets?
if ( true === self::$force_load_all_subsets ) {

if ( isset( $this->fonts[ $font ]['subsets'] ) ) {
foreach ( $this->fonts[ $font ]['subsets'] as $subset ) {
if ( isset( $this->google_fonts[ $font ]['subsets'] ) ) {
foreach ( $this->google_fonts[ $font ]['subsets'] as $subset ) {
$this->subsets[] = $subset;
}
}
Expand Down
24 changes: 15 additions & 9 deletions includes/controls/class-kirki-controls-typography-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ public function to_json() {
$defaults = array(
'font-family' => false,
'font-size' => false,
'line-height' => false,
'variant' => false,
'line-height' => false,
'letter-spacing' => false,
'color' => false,
'text-align' => false,
);
$this->json['default'] = wp_parse_args( $this->json['default'], $defaults );
$this->json['show_variants'] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true;
$this->json['show_subsets'] = ( true === Kirki_Fonts_Google::$force_load_all_subsets ) ? false : true;
}

/**
Expand Down Expand Up @@ -92,14 +94,18 @@ protected function content_template() {
<h5>{{ data.l10n['font-family'] }}</h5>
<select id="kirki-typography-font-family-{{{ data.id }}}" placeholder="{{ data.i18n['select-font-family'] }}"></select>
</div>
<div class="variant hide-on-standard-fonts kirki-variant-wrapper">
<h5>{{ data.l10n['variant'] }}</h5>
<select class="variant" id="kirki-typography-variant-{{{ data.id }}}"></select>
</div>
<div class="subset hide-on-standard-fonts kirki-subset-wrapper">
<h5>{{ data.l10n['subsets'] }}</h5>
<select class="subset" id="kirki-typography-subset-{{{ data.id }}}"></select>
</div>
<# if ( true === data.show_variants || false !== data.default.variant ) { #>
<div class="variant hide-on-standard-fonts kirki-variant-wrapper">
<h5>{{ data.l10n['variant'] }}</h5>
<select class="variant" id="kirki-typography-variant-{{{ data.id }}}"></select>
</div>
<# } #>
<# if ( true === data.show_subsets ) { #>
<div class="subset hide-on-standard-fonts kirki-subset-wrapper">
<h5>{{ data.l10n['subsets'] }}</h5>
<select class="subset" id="kirki-typography-subset-{{{ data.id }}}"></select>
</div>
<# } #>
<# } #>

<# if ( data.default['font-size'] ) { #>
Expand Down

0 comments on commit 508e9af

Please sign in to comment.