flyntwp / flynt-starter-theme

The starter theme for building Flynt projects.
MIT License
69 stars 4 forks source link

How to add inner Flexible layout to Flynt component #308

Closed forevereffort closed 4 years ago

forevereffort commented 4 years ago
<?php

namespace Flynt\Components\PriceTableSection;

function getACFLayout()
{
    return [
        'name' => 'priceTableSection',
        'label' => 'Price: Table Section',
        'sub_fields' => [
            [
                'label' => 'Table List',
                'name' => 'table_list',
                'type' => 'flexible_content',
                'layouts' => [
                    [
                        'name' => 'check_type',
                        'label' => 'Check Type',
                        'display' => 'block',
                        'sub_fields' => [
                            [
                                'label' => 'Title',
                                'name' => 'title',
                                'type' => 'text',
                            ],
                            [
                                'label' => 'Rows',
                                'name' => 'rows',
                                'type' => 'repeater',
                                'layout' => 'table',
                                'button_label' => 'Add New Row',
                                'sub_fields' => [
                                    [
                                        'label' => 'Title',
                                        'name' => 'title',
                                        'type' => 'text',
                                    ],
                                    [
                                        'label' => 'Content',
                                        'name' => 'content',
                                        'type' => 'textarea',
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
                'button_label' => 'Add New Table',
            ]
        ]
    ];
}

I added the inner flexible content into the Flynt Component. but I got the wrong as ' Warning: Cannot get component: Component 'Check_type' is not registered! in \flynt\lib\ComponentManager.php on line 92' after updating.

how can I fix that issue? or my way is wrong?

issue (1)

bdbch commented 4 years ago

Do you want to have an additional flexible content field for rendering components or what is the usecase?

Flynt is trying to search for a CheckType component in your registered component list.

If you're trying to use the flexible content field without the flynt component loader it should be an issue on how flynt wants to load components via the flexible_content field. I guess it shouldn't do that in nested flexible content fields?

bdbch commented 4 years ago

Is this an error with this old version? If you're using the latest version reopen the issue here: https://github.com/flyntwp/flynt

forevereffort commented 4 years ago

Thank you very much for your quick answer.

can you review my 10 sec video?

https://drive.google.com/file/d/1pMyo8DUBm6OoB_mRJRcuEDimMv0cXsse/view

now I am going to add other flexible content into flexible content