default_args = array( 'capability' => 'edit_theme_options', 'option_type' => 'theme_mod', 'option_name' => '', 'compiler' => array(), ); // Process the 'kirki/config' filter by replacing the defaults $this->default_args = $this->config_from_filters(); // Add the config $this->add_config( $id, $args ); } /** * Adds the configuration to the Kirki object. * * @var $config_id the configuration ID. * @var $args the configuration arguments * @return void */ public function add_config( $config_id, $args ) { // Allow empty value as the config ID by setting the id to global. $config_id = ( '' == $config_id ) ? 'global' : $config_id; // Set the config Kirki::$config[ $config_id ] = array_merge( $this->default_args, $args ); } /** * Parses the 'kirki/config' filter. * * @return array */ public function config_from_filters() { // get the args from the filter $args = apply_filters( 'kirki/config', $this->default_args ); // create a valid config by merging with the default args. $valid_args = array(); $valid_args['capability'] = $args['capability']; $valid_args['option_type'] = $args['option_type']; $valid_args['option_name'] = $args['option_name']; $valid_args['compiler'] = $args['compiler']; return $valid_args; } }