add_prefixes() public static method

Add prefixes if necessary.
public static add_prefixes ( array $css ) : array
$css array The CSS definitions array.
return array
Ejemplo n.º 1
0
 /**
  * loop through all fields and create an array of style definitions
  */
 public static function loop_controls()
 {
     // Get an instance of the Kirki_Styles_Output_CSS class.
     // This will make sure google fonts and backup fonts are loaded.
     Kirki_Styles_Output_CSS::get_instance();
     $fields = Kirki::$fields;
     $css = array();
     // Early exit if no fields are found.
     if (empty($fields)) {
         return;
     }
     foreach ($fields as $field) {
         // Only continue if $field['output'] is set
         if (isset($field['output']) && !empty($field['output']) && 'background' != $field['type']) {
             if (function_exists('array_replace_recursive')) {
                 $css = array_replace_recursive($css, Kirki_Styles_Output_CSS::css($field));
             } else {
                 $css = Kirki_Helper::array_replace_recursive($css, Kirki_Styles_Output_CSS::css($field));
             }
         }
     }
     if (is_array($css)) {
         return Kirki_Styles_Output_CSS::styles_parse(Kirki_Styles_Output_CSS::add_prefixes($css));
     }
     return;
 }
 /**
  * loop through all fields and create an array of style definitions
  */
 public static function loop_controls()
 {
     $fields = Kirki::$fields;
     $css = array();
     // Early exit if no fields are found.
     if (empty($fields)) {
         return;
     }
     foreach ($fields as $field) {
         // Only continue if $field['output'] is set
         if (isset($field['output']) && !empty($field['output']) && 'background' != $field['type']) {
             if (function_exists('array_replace_recursive')) {
                 $css = array_replace_recursive($css, Kirki_Styles_Output_CSS::css($field));
             } else {
                 $css = Kirki_Helper::array_replace_recursive($css, Kirki_Styles_Output_CSS::css($field));
             }
         }
     }
     if (is_array($css)) {
         return Kirki_Styles_Output_CSS::styles_parse(Kirki_Styles_Output_CSS::add_prefixes($css));
     }
     return;
 }
Ejemplo n.º 3
0
 /**
  * Loop through all fields and create an array of style definitions.
  *
  * @static
  * @access public
  * @param string $config_id The configuration ID.
  */
 public static function loop_controls($config_id)
 {
     // Get an instance of the Kirki_Styles_Output_CSS class.
     // This will make sure google fonts and backup fonts are loaded.
     Kirki_Styles_Output_CSS::get_instance();
     $fields = Kirki::$fields;
     $css = array();
     // Early exit if no fields are found.
     if (empty($fields)) {
         return;
     }
     foreach ($fields as $field) {
         // Only process fields that belong to $config_id.
         if ($config_id != $field['kirki_config']) {
             continue;
         }
         // Only continue if field dependencies are met.
         if (!empty($field['required'])) {
             $valid = true;
             foreach ($field['required'] as $requirement) {
                 if (isset($requirement['setting']) && isset($requirement['value']) && isset($requirement['operator'])) {
                     $controller_value = Kirki_Values::get_value($config_id, $requirement['setting']);
                     if (!Kirki_Active_Callback::compare($controller_value, $requirement['value'], $requirement['operator'])) {
                         $valid = false;
                     }
                 }
             }
             if (!$valid) {
                 continue;
             }
         }
         // Only continue if $field['output'] is set.
         if (isset($field['output']) && !empty($field['output']) && 'background' != $field['type']) {
             $css = Kirki_Helper::array_replace_recursive($css, Kirki_Styles_Output_CSS::css($field));
             // Add the globals.
             if (isset(self::$css_array[$config_id]) && !empty(self::$css_array[$config_id])) {
                 Kirki_Helper::array_replace_recursive($css, self::$css_array[$config_id]);
             }
         }
     }
     $css = apply_filters('kirki/' . $config_id . '/styles', $css);
     if (is_array($css)) {
         return Kirki_Styles_Output_CSS::styles_parse(Kirki_Styles_Output_CSS::add_prefixes($css));
     }
     return;
 }