我是新来的Redux. 我不知道如何使用开关显示和隐藏文本区域(不保存)。当my switch(我的开关)打开时,文本输入将显示,当它关闭时,输入将隐藏自己。我试着用动作钩,但没用。
这是我的代码:
Redux::setSection( $opt_name, array(
\'title\' => __( \'Test\', \'redux-test\' ),
\'id\' => \'switch_buttonset\',
\'desc\' => __( \'\', \'redux-test\'),
\'icon\' => \'el el-cog\',
\'fields\' => array(
array(
\'id\' => \'opt-text-email\',
\'type\' => \'text\',
\'title\' => __( \'Title\', \'redux-test\' ),
),
array(
\'id\' => \'switch-on\',
\'type\' => \'switch\',
\'title\' => __( \'Switch On\', \'redux-framework-demo\' ),
\'default\' => true,
),
)
) );
add_action( \'redux/field/\' . $opt_name . \'/switch/callback/after\', \'compiler_action\', 10, 3 );
function compiler_action( $data ) {
global $opt_name;
Redux::hideField( $opt_name, \'opt-text-email\' );
}