Support

Account

Home Forums Backend Issues (wp-admin) Display Fields corectly based on Coditions

Helping

Display Fields corectly based on Coditions

  • Hi guys i am developing a plugin for my own purpose nothing commercial, it’s just a way to automate my future work and I am facing something peculiar, I admit I am not using the latest version of ACF because I am developing on localhost, I am not willing to use my licence on a localhost environment.
    So this is not necessary a technical issue, I mean is something between frontend a backend, I admit I am able to fix this somehow but I need to know if there is a propper method to do it:

    I have a big repeater field and there are conditions all around it, when it comes to display fields based on these conditions, will mess things around, spacings, etc.

    this is the json Fields :

    
    acf_add_local_field_group(array(
            'key' => 'group_66125eef10578',
            'title' => 'Slideshow',
            'fields' => array(
                array(
                    'key' => 'field_6614259e8d6f3',
                    'label' => 'Slideshow',
                    'name' => '',
                    'type' => 'tab',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '',
                        'class' => '',
                        'id' => '',
                    ),
                    'placement' => 'top',
                    'endpoint' => 0,
                ),
                array(
                    'key' => 'field_661435860c17d',
                    'label' => 'Slideshow Post type',
                    'name' => 'slideshow_post_type',
                    'type' => 'select',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '',
                        'class' => '',
                        'id' => '',
                    ),
                    'choices' => array(
                        'multimedia' => 'Multimedia',
                        'products' => 'Products',
                        'gallery' => 'Gallery',
                        'posts' => 'Posts / Pages / Custom CTPS',
                    ),
                    'default_value' => false,
                    'allow_null' => 0,
                    'multiple' => 0,
                    'ui' => 0,
                    'return_format' => 'value',
                    'ajax' => 0,
                    'placeholder' => '',
                ),
                array(
                    'key' => 'field_66125ef55e8f9',
                    'label' => 'Slides',
                    'name' => 'slideshows',
                    'type' => 'repeater',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => array(
                        array(
                            array(
                                'field' => 'field_661435860c17d',
                                'operator' => '==',
                                'value' => 'multimedia',
                            ),
                        ),
                    ),
                    'wrapper' => array(
                        'width' => '',
                        'class' => '',
                        'id' => '',
                    ),
                    'collapsed' => '',
                    'min' => 0,
                    'max' => 0,
                    'layout' => 'table',
                    'button_label' => '',
                    'sub_fields' => array(
                        array(
                            'key' => 'field_66125f765e8fa',
                            'label' => 'Slide Type',
                            'name' => 'slide_type',
                            'type' => 'select',
                            'instructions' => 'Select the type of the slide you want to display',
                            'required' => 0,
                            'conditional_logic' => 0,
                            'wrapper' => array(
                                'width' => '20',
                                'class' => '',
                                'id' => '',
                            ),
                            'choices' => array(
                                'image' => 'Only Image',
                                'video' => 'Only Video',
                                'custom' => 'Custom Slide',
                            ),
                            'default_value' => false,
                            'allow_null' => 0,
                            'multiple' => 0,
                            'ui' => 0,
                            'return_format' => 'value',
                            'ajax' => 0,
                            'placeholder' => '',
                        ),
                        array(
                            'key' => 'field_6612a963f9b30',
                            'label' => 'Slide Custom Background',
                            'name' => 'slide_custom_background',
                            'type' => 'select',
                            'instructions' => '',
                            'required' => 0,
                            'conditional_logic' => array(
                                array(
                                    array(
                                        'field' => 'field_66125f765e8fa',
                                        'operator' => '==',
                                        'value' => 'custom',
                                    ),
                                ),
                            ),
                            'wrapper' => array(
                                'width' => '20',
                                'class' => '',
                                'id' => '',
                            ),
                            'choices' => array(
                                'image' => 'Image background',
                                'video' => 'Video background',
                            ),
                            'default_value' => false,
                            'allow_null' => 0,
                            'multiple' => 0,
                            'ui' => 0,
                            'return_format' => 'value',
                            'ajax' => 0,
                            'placeholder' => '',
                        ),
                        array(
                            'key' => 'field_6614add9153df',
                            'label' => 'Apply overlay',
                            'name' => 'apply_overlay',
                            'type' => 'true_false',
                            'instructions' => '',
                            'required' => 0,
                            'conditional_logic' => 0,
                            'wrapper' => array(
                                'width' => '20',
                                'class' => '',
                                'id' => '',
                            ),
                            'message' => '',
                            'default_value' => 0,
                            'ui' => 0,
                            'ui_on_text' => '',
                            'ui_off_text' => '',
                        ),
                        array(
                            'key' => 'field_6614adfb153e0',
                            'label' => 'Overlay color',
                            'name' => 'overlay_color',
                            'type' => 'color_picker',
                            'instructions' => '',
                            'required' => 0,
                            'conditional_logic' => array(
                                array(
                                    array(
                                        'field' => 'field_6614add9153df',
                                        'operator' => '==',
                                        'value' => '1',
                                    ),
                                ),
                            ),
                            'wrapper' => array(
                                'width' => '20',
                                'class' => '',
                                'id' => '',
                            ),
                            'default_value' => '',
                            'enable_opacity' => 1,
                            'return_format' => 'string',
                        ),
                        array(
                            'key' => 'field_661260ac186f8',
                            'label' => 'Slide Image',
                            'name' => 'slide_image',
                            'type' => 'image',
                            'instructions' => '',
                            'required' => 0,
                            'conditional_logic' => array(
                                array(
                                    array(
                                        'field' => 'field_66125f765e8fa',
                                        'operator' => '==',
                                        'value' => 'image',
                                    ),
                                ),
                                array(
                                    array(
                                        'field' => 'field_66125f765e8fa',
                                        'operator' => '==',
                                        'value' => 'custom',
                                    ),
                                ),
                                array(
                                    array(
                                        'field' => 'field_6612a963f9b30',
                                        'operator' => '==',
                                        'value' => 'image',
                                    ),
                                ),
                            ),
                            'wrapper' => array(
                                'width' => '20',
                                'class' => '',
                                'id' => '',
                            ),
                            'return_format' => 'array',
                            'preview_size' => 'medium',
                            'library' => 'all',
                            'min_width' => '',
                            'min_height' => '',
                            'min_size' => '',
                            'max_width' => '',
                            'max_height' => '',
                            'max_size' => '',
                            'mime_types' => '',
                        ),
                        array(
                            'key' => 'field_6612a83ca59b6',
                            'label' => 'Slideshow Video',
                            'name' => 'slideshow_video',
                            'type' => 'url',
                            'instructions' => '',
                            'required' => 0,
                            'conditional_logic' => array(
                                array(
                                    array(
                                        'field' => 'field_66125f765e8fa',
                                        'operator' => '==',
                                        'value' => 'video',
                                    ),
                                ),
                                array(
                                    array(
                                        'field' => 'field_6612a963f9b30',
                                        'operator' => '==',
                                        'value' => 'video',
                                    ),
                                ),
                            ),
                            'wrapper' => array(
                                'width' => '20',
                                'class' => '',
                                'id' => '',
                            ),
                            'default_value' => '',
                            'placeholder' => '',
                        ),
                        array(
                            'key' => 'field_6612a74c96a57',
                            'label' => 'Slideshow Text',
                            'name' => 'slideshow_text',
                            'type' => 'wysiwyg',
                            'instructions' => '',
                            'required' => 0,
                            'conditional_logic' => array(
                                array(
                                    array(
                                        'field' => 'field_66125f765e8fa',
                                        'operator' => '==',
                                        'value' => 'custom',
                                    ),
                                ),
                            ),
                            'wrapper' => array(
                                'width' => '20',
                                'class' => '',
                                'id' => '',
                            ),
                            'default_value' => '',
                            'tabs' => 'all',
                            'toolbar' => 'full',
                            'media_upload' => 1,
                            'delay' => 0,
                        ),
                        array(
                            'key' => 'field_6612a76a96a58',
                            'label' => 'Slideshow Text orientation',
                            'name' => 'slideshow_text_orientation',
                            'type' => 'select',
                            'instructions' => '',
                            'required' => 0,
                            'conditional_logic' => array(
                                array(
                                    array(
                                        'field' => 'field_66125f765e8fa',
                                        'operator' => '==',
                                        'value' => 'custom',
                                    ),
                                ),
                            ),
                            'wrapper' => array(
                                'width' => '20',
                                'class' => '',
                                'id' => '',
                            ),
                            'choices' => array(
                                'left' => 'Align Left',
                                'right' => 'Align Right',
                                'center' => 'Align Center',
                            ),
                            'default_value' => false,
                            'allow_null' => 0,
                            'multiple' => 0,
                            'ui' => 0,
                            'return_format' => 'value',
                            'ajax' => 0,
                            'placeholder' => '',
                        ),
                        array(
                            'key' => 'field_6614277a8d6fa',
                            'label' => 'Slideshow interval',
                            'name' => 'slideshow_interval',
                            'type' => 'number',
                            'instructions' => '',
                            'required' => 0,
                            'conditional_logic' => 0,
                            'wrapper' => array(
                                'width' => '20',
                                'class' => '',
                                'id' => '',
                            ),
                            'default_value' => '',
                            'placeholder' => '',
                            'prepend' => '',
                            'append' => '',
                            'min' => '',
                            'max' => '',
                            'step' => '',
                        ),
                    ),
                ),
                array(
                    'key' => 'field_6614b1ec5fc8f',
                    'label' => 'Gallery Slides',
                    'name' => 'gallery_slides',
                    'type' => 'gallery',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => array(
                        array(
                            array(
                                'field' => 'field_661435860c17d',
                                'operator' => '==',
                                'value' => 'gallery',
                            ),
                        ),
                    ),
                    'wrapper' => array(
                        'width' => '',
                        'class' => '',
                        'id' => '',
                    ),
                    'return_format' => 'array',
                    'preview_size' => 'medium',
                    'insert' => 'append',
                    'library' => 'all',
                    'min' => '',
                    'max' => '',
                    'min_width' => '',
                    'min_height' => '',
                    'min_size' => '',
                    'max_width' => '',
                    'max_height' => '',
                    'max_size' => '',
                    'mime_types' => '',
                ),
                array(
                    'key' => 'field_661425b48d6f4',
                    'label' => 'Options',
                    'name' => '',
                    'type' => 'tab',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '',
                        'class' => '',
                        'id' => '',
                    ),
                    'placement' => 'top',
                    'endpoint' => 0,
                ),
                array(
                    'key' => 'field_661425d48d6f5',
                    'label' => 'Slideshow Height',
                    'name' => 'slideshow_height',
                    'type' => 'select',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '33.3',
                        'class' => '',
                        'id' => '',
                    ),
                    'choices' => array(
                        'px' => 'Pixels',
                        'vh' => 'View Port Height',
                    ),
                    'default_value' => false,
                    'allow_null' => 0,
                    'multiple' => 0,
                    'ui' => 0,
                    'return_format' => 'value',
                    'ajax' => 0,
                    'placeholder' => '',
                ),
                array(
                    'key' => 'field_661426208d6f6',
                    'label' => 'Height Number',
                    'name' => 'height_number',
                    'type' => 'number',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '33.3',
                        'class' => '',
                        'id' => '',
                    ),
                    'default_value' => '',
                    'placeholder' => '',
                    'prepend' => '',
                    'append' => '',
                    'min' => '',
                    'max' => '',
                    'step' => '',
                ),
                array(
                    'key' => 'field_6614ad39baef8',
                    'label' => 'Inherit theme colors',
                    'name' => 'inherit_theme_colors',
                    'type' => 'true_false',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '33.3',
                        'class' => '',
                        'id' => '',
                    ),
                    'message' => '',
                    'default_value' => 0,
                    'ui' => 0,
                    'ui_on_text' => '',
                    'ui_off_text' => '',
                ),
                array(
                    'key' => 'field_6614264e8d6f7',
                    'label' => 'Display Arrows',
                    'name' => 'display_arrows',
                    'type' => 'true_false',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '33.3',
                        'class' => '',
                        'id' => '',
                    ),
                    'message' => '',
                    'default_value' => 0,
                    'ui' => 0,
                    'ui_on_text' => '',
                    'ui_off_text' => '',
                ),
                array(
                    'key' => 'field_6614acf4baef6',
                    'label' => 'Arrow Color',
                    'name' => 'arrow_color',
                    'type' => 'color_picker',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => array(
                        array(
                            array(
                                'field' => 'field_6614ad39baef8',
                                'operator' => '!=',
                                'value' => '1',
                            ),
                        ),
                    ),
                    'wrapper' => array(
                        'width' => '33.3',
                        'class' => '',
                        'id' => '',
                    ),
                    'default_value' => '',
                    'enable_opacity' => 1,
                    'return_format' => 'string',
                ),
                array(
                    'key' => 'field_661426618d6f8',
                    'label' => 'Display Indicator',
                    'name' => 'display_indicator',
                    'type' => 'true_false',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '33.3',
                        'class' => '',
                        'id' => '',
                    ),
                    'message' => '',
                    'default_value' => 0,
                    'ui' => 0,
                    'ui_on_text' => '',
                    'ui_off_text' => '',
                ),
                array(
                    'key' => 'field_6614ad1bbaef7',
                    'label' => 'Indicators color',
                    'name' => 'indicators_color',
                    'type' => 'color_picker',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => array(
                        array(
                            array(
                                'field' => 'field_6614ad39baef8',
                                'operator' => '!=',
                                'value' => '1',
                            ),
                        ),
                    ),
                    'wrapper' => array(
                        'width' => '33.3',
                        'class' => '',
                        'id' => '',
                    ),
                    'default_value' => '',
                    'enable_opacity' => 1,
                    'return_format' => 'string',
                ),
                array(
                    'key' => 'field_661426ca8d6f9',
                    'label' => 'Slideshow Sliding Effect',
                    'name' => 'slideshow_sliding_effect',
                    'type' => 'select',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '33.3',
                        'class' => '',
                        'id' => '',
                    ),
                    'choices' => array(
                        'normal' => 'Normal Slide / Swipe',
                        'fade' => 'Fade in Slide',
                    ),
                    'default_value' => false,
                    'allow_null' => 0,
                    'multiple' => 0,
                    'ui' => 0,
                    'return_format' => 'value',
                    'ajax' => 0,
                    'placeholder' => '',
                ),
            ),
            'location' => array(
                array(
                    array(
                        'param' => 'post_type',
                        'operator' => '==',
                        'value' => 'evx_slideshow',
                    ),
                ),
            ),
            'menu_order' => 0,
            'position' => 'normal',
            'style' => 'default',
            'label_placement' => 'top',
            'instruction_placement' => 'label',
            'hide_on_screen' => '',
            'active' => true,
            'description' => '',
            'show_in_rest' => 0,
        ));
    
    endif;
    

    This is the image with the mess it brings :
    Check this out

    In advance, i don’t need to help me developing a solution, i just need to know if there is something you guys know how to easy deal with or if i mistake something in my implementation of displaying these fields.
    Cheers, Lucian.

  • https:// ibb.co / d5xSmg8 this would be the image.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.