Activate fields conditionally
-
Hi,
i am doing a page builder with complex fields groups, each group is a layout.
i want to put options to activate certain layouts or not, as i will use this plugin to build different themes.
so i have made theme options with setontainer::make( 'theme_options', 'Theme Options' ) ->add_fields( array( Field::make( 'set', 'crb_active_layouts' ) ->add_options( array( 'text_area' => 'Text Area', 'slider' => 'Slider', 'slideshow_panel' => 'Slideshow Panel', 'parallax' => 'Parallax Area', 'panel_switcher' => 'Panel Switcher' ) ) ) );
then retrieve the array like that
$active_layouts = carbon_get_theme_option('crb_active_layouts');
then i suppose i can make the condition like thatif(in_array(‘slider’,$active_layouts){
//Field registration
}i think my logic is good, but not the syntax, perhaps because i am bad with oop
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Activate fields conditionally’ is closed to new replies.