/** * Outputs typography font face fields * * @param $key * @param $value * @return string */ public function typography_font_face($key, $value) { $html = ''; $font_faces = wf_get_system_fonts(); $google_fonts = wf_get_google_fonts(); if (0 < count($google_fonts)) { $font_faces[''] = __('-- Google WebFonts --', 'woothemes'); $google_fonts_array = array(); foreach ($google_fonts as $k => $v) { $google_fonts_array[$v['name']] = $v['name']; } asort($google_fonts_array); $font_faces = array_merge($font_faces, $google_fonts_array); } if (0 < count($font_faces)) { $test_cases = wf_get_system_fonts_test_cases(); $html .= '<select class="woo-typography woo-typography-font-face woo-typography-face" name="' . esc_attr($key . '[face]') . '" id="' . esc_attr($key . '_face') . '">' . "\n"; //Font Options for select $html .= output_font_select_options($font_faces, $test_cases, $value['face']); $html .= '</select>' . "\n"; } return $html; }
/** * Get Font Family Control * * Gets the font family select control. Will only show * the fonts from the applicable subset if it has been * selected. * * @uses EGF_Font_Utilities::get_google_fonts() defined in includes\class-egf-font-utilities * @uses EGF_Font_Utilities::get_default_fonts() defined in includes\class-egf-font-utilities * * @since 1.2 * @version 1.3.1 * */ public function get_font_family_control() { // Get defaults and current value $this_value = $this->value('font_id'); $default_value = $this->default['font_id']; $current_value = empty($this_value) ? '' : $this_value; // Get all font families $all_fonts = PootlePage_Font_Utility::get_all_fonts(); // Get control view ?> <label><?php _e('Font Family', 'scratch'); ?> <select class='sc-font-family-list' <?php $this->link('font_id'); ?> data-default-value="<?php echo $default_value; ?> " autocomplete="off"> <option value="" <?php selected($current_value, ''); ?> ><?php _e('— Default —', 'scratch'); ?> </option> <?php if (function_exists('wf_get_system_fonts_test_cases')) { $test_cases = wf_get_system_fonts_test_cases(); } else { $test_cases = array(); } //Font Options for select echo output_font_select_options($all_fonts, $test_cases, $current_value); ?> </select> </label> <?php }