Support

Account

Home Forums ACF PRO acf add local field to flexible content Reply To: acf add local field to flexible content

  • sweet, however the issue is actually the_flexible_field(),
    get_row_layout() is not finding the layout. i have tried getting ‘repeat_content’ and ‘content_columns’ but neither is working

    <?php
    
        while(the_flexible_field('flexible_content')): 
          echo '<h2>flexi heading</h2>';
          switch (get_row_layout()):
    	 
    	  case 'repeat_content':
    	    echo '<h2>heading</h2>';
    		  if (function_exists('repeat_content')):
    		       content_columns();
    		    else:
    		      echo 'content col is not enabled';
    		  endif;
    	  break;
    	  case 'includes':
    		  if (function_exists('ml_acf_include')): 
    		      ml_acf_include();
    		    else:
    		      echo 'includes is not enabled';
    		    endif;
    	  break;
    	endswitch;
        endwhile; 
    

    heres the output of flexible_content

    Array
    (
        [ID] => 0
        [key] => field_flex_key
        [label] => flexible content
        [name] => flexible_content
        [prefix] => 
        [type] => flexible_content
        [value] => 
        [menu_order] => 0
        [instructions] => 
        [required] => 0
        [id] => 
        [class] => 
        [conditional_logic] => 0
        [parent] => group_56ff5b11d1775
        [wrapper] => Array
            (
                [width] => 
                [class] => 
                [id] => 
            )
    
        [_name] => flexible_content
        [_input] => 
        [_valid] => 1
        [button_label] => Add Component
        [min] => 
        [max] => 
        [layouts] => Array
            (
                [0] => Array
                    (
                        [key] => layout_key
                        [name] => layouts
                        [label] => Components
                        [display] => block
                        [sub_fields] => Array
                            (
                                [0] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_57032097d3ac0
                                        [label] => Content Columns
                                        [name] => content_columns
                                        [prefix] => 
                                        [type] => tab
                                        [value] => 
                                        [menu_order] => 0
                                        [instructions] => 
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => content_columns
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [placement] => top
                                        [endpoint] => 0
                                    )
    
                                [1] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_repeatable_key
                                        [label] => Repeatable image with optional link
                                        [name] => repeat_content
                                        [prefix] => 
                                        [type] => repeater
                                        [value] => 
                                        [menu_order] => 1
                                        [instructions] => 
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => repeat_content
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [row_min] => 0
                                        [row_limit] => 
                                        [layout] => table
                                        [button_label] => Add Component
                                        [sub_fields] => Array
                                            (
                                                [0] => Array
                                                    (
                                                        [ID] => 0
                                                        [key] => field_56a749bdc0553
                                                        [label] => Content Column
                                                        [name] => text_area
                                                        [prefix] => 
                                                        [type] => wysiwyg
                                                        [value] => 
                                                        [menu_order] => 0
                                                        [instructions] => 
                                                        [required] => 0
                                                        [id] => 
                                                        [class] => 
                                                        [conditional_logic] => 0
                                                        [parent] => field_repeatable_key
                                                        [wrapper] => Array
                                                            (
                                                                [width] => 
                                                                [class] => 
                                                                [id] => 
                                                            )
    
                                                        [_name] => text_area
                                                        [_input] => 
                                                        [_valid] => 1
                                                        [default_value] => 
                                                        [tabs] => all
                                                        [toolbar] => full
                                                        [media_upload] => 1
                                                    )
    
                                            )
    
                                        [min] => 0
                                        [max] => 0
                                        [collapsed] => 
                                    )
    
                                [2] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_styling_tab
                                        [label] => Row Styling
                                        [name] => row_styling
                                        [prefix] => 
                                        [type] => tab
                                        [value] => 
                                        [menu_order] => 2
                                        [instructions] => 
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => row_styling
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [placement] => top
                                        [endpoint] => 0
                                    )
    
                                [3] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_570320bbd3ac1
                                        [label] => row class
                                        [name] => row_class
                                        [prefix] => 
                                        [type] => text
                                        [value] => 
                                        [menu_order] => 3
                                        [instructions] => 
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => row_class
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [default_value] => 
                                        [placeholder] => 
                                        [prepend] => 
                                        [append] => 
                                        [maxlength] => 
                                        [readonly] => 0
                                        [disabled] => 0
                                    )
    
                                [4] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_57031ca0179ba
                                        [label] => boxed content
                                        [name] => boxed_content
                                        [prefix] => 
                                        [type] => true_false
                                        [value] => 
                                        [menu_order] => 4
                                        [instructions] => the width of the content will be limited to the amount set in the stylesheet code.
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => boxed_content
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [message] => 
                                        [default_value] => 1
                                    )
    
                                [5] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_57031c64179b9
                                        [label] => invert colors
                                        [name] => invert_colors
                                        [prefix] => 
                                        [type] => true_false
                                        [value] => 
                                        [menu_order] => 5
                                        [instructions] => dark color scheme for this panel instead of a light color scheme
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => invert_colors
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [message] => invert color scheme
                                        [default_value] => 0
                                    )
    
                                [6] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_57031b1b179b8
                                        [label] => style options
                                        [name] => style_options
                                        [prefix] => 
                                        [type] => select
                                        [value] => 
                                        [menu_order] => 6
                                        [instructions] => 
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => style_options
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [choices] => Array
                                            (
                                                [None] => None
                                                [option 1] => option 1
                                                [option 2] => option 2
                                            )
    
                                        [default_value] => Array
                                            (
                                            )
    
                                        [allow_null] => 0
                                        [multiple] => 0
                                        [ui] => 0
                                        [ajax] => 0
                                        [placeholder] => 
                                        [disabled] => 0
                                        [readonly] => 0
                                    )
    
                                [7] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_57031afc179b7
                                        [label] => bg_image
                                        [name] => bg_image
                                        [prefix] => 
                                        [type] => image
                                        [value] => 
                                        [menu_order] => 7
                                        [instructions] => 
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => bg_image
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [return_format] => array
                                        [preview_size] => thumbnail
                                        [library] => all
                                        [min_width] => 
                                        [min_height] => 
                                        [min_size] => 
                                        [max_width] => 
                                        [max_height] => 
                                        [max_size] => 
                                        [mime_types] => 
                                    )
    
                            )
    
                        [min] => 
                        [max] => 
                    )
    
            )
    
    )