kirki icon indicating copy to clipboard operation
kirki copied to clipboard

'code' not working on 'preset'

Open humanagent opened this issue 5 years ago • 0 comments

Hello guys, i cant make preset to work with code.

Kirki::add_field( 'theme_config_id', [
	'type'        => 'radio',
	'settings'    => 'color_scheme_radio',
	'label'       => esc_attr__( 'Radio Control', 'kirki' ),
	'description' => esc_attr__( 'This radio will control the following two color controls.', 'kirki' ),
	'section'     => 'preset_section',
	'default'     => 'header1',
	'choices'     => [
		'header1'    => esc_html__( 'Header1', 'kirki' ),
		'header2'   => esc_html__( 'Header2', 'kirki' ),
		'header3' => esc_html__( 'Header3', 'kirki' ),
	],
	'preset'      => array(
		'header1'    => array(
			'settings' => array(
				'code_example' => '<div>example</div>'
			),
		),
		'header2'   => [
			'settings' => [
				'code_example' => '<div>example</div>'
			],
		],
		'header3' => [
			'settings' => [
				'code_example' => '<div>example</div>'
			],
		],
	),
] );


Kirki::add_field( 'theme_config_id', array(
	'type'        => 'code',
	'settings'    => 'code_example',
	'label'       => __( 'Header Code', 'fastway' ),
	'description' => '',
	'section'     => 'preset_section',
	'choices'     => array(
		'language' => 'html',
	),
) );`

I'm also getting this message when switching


codemirror.min.js?ver=5.29.1-alpha-ee20357:23 Uncaught TypeError: a.split is not a function
    at $g (codemirror.min.js?ver=5.29.1-alpha-ee20357:23)
    at Eh.splitLines (codemirror.min.js?ver=5.29.1-alpha-ee20357:23)
    at Eh.<anonymous> (codemirror.min.js?ver=5.29.1-alpha-ee20357:23)
    at Eh.setValue (codemirror.min.js?ver=5.29.1-alpha-ee20357:21)
    at Pf.setValue (codemirror.min.js?ver=5.29.1-alpha-ee20357:24)
    at Function.<anonymous> (customize-controls.min.js?ver=5.5:2)
    at i (load-scripts.php?c=1&load[chunk_0]=jquery&ver=5.5:2)
    at Object.fireWith (load-scripts.php?c=1&load[chunk_0]=jquery&ver=5.5:2)
    at Function.set (customize-base.min.js?ver=5.5:2)
    at Function.d [as set] (load-scripts.php?c=1&load[chunk_0]=jquery&ver=5.5:2)

humanagent avatar Aug 27 '20 00:08 humanagent