public static function get_css($theme_options, $saved_data) { if (!self::$initialized) { self::$google_fonts = fw_get_google_fonts(); self::$initialized = true; } //generate css $css = ''; foreach ($theme_options as $option_name => $option_settings) { if ($option_settings['type'] !== 'style') { unset($theme_options[$option_name]); continue; } $css .= self::generate_option_css($option_settings['blocks'], $saved_data[$option_name]); break; } if (!empty($css)) { $css = self::get_remote_fonts() . "\n<style type='text/css'>\n" . $css . "\n</style>"; } return $css; }
/** * Triggers when the extension settings are saved, * it generates css from the styling settings and stores it * @internal */ public function _admin_action_generate_css() { $theme_options = fw_extract_only_options($this->get_options('appearance-settings')); $saved_data = fw_get_db_extension_data($this->get_name(), 'options'); $css_for_style_options = FW_Styling_Css_Generator::get_css($theme_options, $saved_data); fw_set_db_extension_data($this->get_name(), 'css', $css_for_style_options); }