コード例 #1
0
 /**
  * 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_sanitized = Kirki_Field_Sanitize::sanitize_field($field);
     /**
      * Set class vars
      */
     self::$settings = $field_sanitized['settings'];
     self::$callback = $field_sanitized['sanitize_callback'];
     self::$field_type = $field_sanitized['type'];
     self::$output = $field_sanitized['output'];
     if (!is_array(self::$output)) {
         self::$output = array(array('element' => self::$output, 'sanitize_callback' => null));
     }
     /**
      * Get the value of this field
      */
     self::$value = Kirki_Values::get_sanitized_field_value($field_sanitized);
     /**
      * Returns the styles
      */
     return self::styles();
 }
コード例 #2
0
 /**
  * Get the CSS for a field.
  *
  * @static
  * @access public
  * @param array $field The field.
  * @return array
  */
 public static function css($field)
 {
     // Set class vars.
     self::$settings = $field['settings'];
     self::$callback = $field['sanitize_callback'];
     self::$field_type = $field['type'];
     self::$output = $field['output'];
     if (!is_array(self::$output)) {
         self::$output = array(array('element' => self::$output, 'sanitize_callback' => null));
     }
     // Get the value of this field.
     self::$value = Kirki_Values::get_sanitized_field_value($field);
     // Find the class that will handle the outpout for this field.
     $classname = 'Kirki_Output';
     $field_output_classes = apply_filters('kirki/' . $field['kirki_config'] . '/output/control-classnames', array('kirki-spacing' => 'Kirki_Output_Field_Spacing', 'kirki-typography' => 'Kirki_Output_Field_Typography', 'kirki-multicolor' => 'Kirki_Output_Field_Multicolor'));
     if (array_key_exists(self::$field_type, $field_output_classes)) {
         $classname = $field_output_classes[self::$field_type];
     }
     $obj = new $classname($field['kirki_config'], self::$output, self::$value);
     return $obj->get_styles();
 }