jcchavezs / cmb2-conditionals

Plugin to relate fields in a CMB2 metabox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working on theme options page

applesapples1 opened this issue · comments

Conditional plugin is not working on theme options.

$cookie_options = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => esc_html__( 'Cookie Notice', 'microlise' ),
'object_types' => array( 'options-page' ),
'option_key' => 'microlise_cookies',
'menu_title' => esc_html__( 'Cookie Notice', 'microlise' ),
'parent_slug' => 'settings.php',
'admin_menu_hook' => 'network_admin_menu',
'save_button' => esc_html__( 'Save Changes', 'microlise' ),
) );

$cookie_options->add_field( array(
	'name' => __( 'More Info Link', 'microlise' ),
	'desc' => __( 'Enable Read more link.', 'microlise' ),
	'id'   => $prefix . 'more',
	'type' => 'checkbox',
) );

$cookie_options->add_field( array(
	'name' => __( ' ', 'microlise' ),
	'desc' => __( 'The text of the more info button.', 'microlise' ),
	'id'   => $prefix . 'more_text',
	'type' => 'text',
	'attributes' => array(
		'data-conditional-id' => $prefix . 'more',
		'data-conditional-value' => 'on',
	),
) );

Answer here: #57