This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

mzboril
mzboril

Hi, I have problem with extending plugin by adding repeater fields. When I added code for adding repeater fields, everything is okay but in the repeater field I have all fields from form. Do you know how to fix this bug? The code is bellow...

The repeater field name is files and it should have only one field which name is file, but it has all fields.

        $widget->addSecondaryTabFields([

            'files_size' => [
                'label' => Lang::get('webbook.downloader::lang.fields.files_size'),
                'type' => 'dropdown',
                'span' => 'auto',
                'emptyOption' => '-- Empty option --',
                'tab' => Lang::get('webbook.downloader::lang.tabs.downloads'),
                'options' => [
                    'table'     =>'webbook.downloader::lang.components.properties.table', 
                    'small'     =>'webbook.downloader::lang.components.properties.smallcard', 
                    'big'       =>'webbook.downloader::lang.components.properties.bigcard'
                ]
            ],
            'category_size' => [
                'label' => Lang::get('webbook.downloader::lang.fields.category_size'),
                'type' => 'dropdown',
                'span' => 'auto',
                'emptyOption' => '-- Empty option --',
                'tab' => Lang::get('webbook.downloader::lang.tabs.downloads'),
                'options' => [
                    'table'     =>'webbook.downloader::lang.components.properties.table', 
                    'small'     =>'webbook.downloader::lang.components.properties.smallcard', 
                    'big'       =>'webbook.downloader::lang.components.properties.bigcard'
                ]
            ],
            'files_description' => [
                'label' => Lang::get('webbook.downloader::lang.fields.not_files_description'),
                'type' => 'switch',
                'span' => 'auto',
                'tab' => Lang::get('webbook.downloader::lang.tabs.downloads'),
            ],
            'category_description' => [
                'label' => Lang::get('webbook.downloader::lang.fields.not_category_description'),
                'type' => 'switch',
                'span' => 'auto',
                'tab' => Lang::get('webbook.downloader::lang.tabs.downloads'),
            ],
            'files' => [
                'label' => Lang::get('webbook.downloader::lang.fields.files'),
                'prompt' => Lang::get('webbook.downloader::lang.fields.file'),
                'tab' => Lang::get('webbook.downloader::lang.tabs.downloads'),
                'span' => 'auto',
                'type' => 'repeater',
                'form' => [
                    'fields' => [
                        'file' => [
                            'label' => Lang::get('webbook.downloader::lang.fields.file'),
                            'span' => 'full',
                            'type' => 'relation',
                        ]
                    ]
                ]
            ],
            'downloader_category' => [
                'label' => Lang::get('webbook.downloader::lang.fields.category'),
                'span' => 'auto',
                'emptyOption' => '-- Empty option --',
                'tab' => Lang::get('webbook.downloader::lang.tabs.downloads'),
                'type' => 'relation',
            ],
        ]);
Zaq
Zaq

Wrap the addSecondaryTabFields function in if (!$form->isNested) { and it works

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.