/** * The class constructor. * * @var string the setting ID. * @var string theme_mod / option * @var array an array of arrays of the output arguments. * @var mixed a callable function. */ public static function css($field) { /** * Make sure the field is sanitized before proceeding any further. */ $field = Kirki_Field::sanitize_field($field); /** * Get the config ID used in the Kirki class. */ $config_id = Kirki::get_config_id($field); /** * Set class vars */ self::$settings = $field['settings']; self::$output = $field['output']; self::$callback = $field['sanitize_callback']; /** * Get the value of this field */ if ('option' == Kirki::$config[$config_id]['option_type'] && '' != Kirki::$config[$config_id]['option_name']) { self::$value = Kirki::get_option($config_id, str_replace(array(']', Kirki::$config[$config_id]['option_name'] . '['), '', $field['settings'])); } else { self::$value = Kirki::get_option($config_id, $field['settings']); } /** * Returns the styles */ if (!is_array(self::$value)) { return self::styles(); } }
/** * The class constructor. * * @var string the setting ID. * @var string theme_mod / option * @var array an array of arrays of the output arguments. * @var mixed a callable function. */ public static function css($setting = '', $type = 'theme_mod', $output = array(), $callback = '', $return_array = false) { // No need to proceed any further if we don't have the required arguments. if ('' == $setting || empty($output)) { return; } self::$settings = $setting; self::$type = $type; self::$output = Kirki_Field::sanitize_output(array('output' => $output)); self::$value = self::get_value(); self::$callback = $callback; return true === $return_array ? self::styles() : self::styles_parse(self::add_prefixes(self::styles())); }