Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataObject] Error: FieldList Root tab didn't exists #386

Open
ghost opened this issue Mar 28, 2018 · 3 comments
Open

[DataObject] Error: FieldList Root tab didn't exists #386

ghost opened this issue Mar 28, 2018 · 3 comments

Comments

@ghost
Copy link

ghost commented Mar 28, 2018

Hi everyone,

I'm integrating this module on my SS 4.0.3 project. It currently got 2 langs. I'm trying to follow the docs to configure has-many dataobjects in relation to their respective pages. Here's my project.yml:

[...]
---
  Name: traduzioni
---
# DataObject 1
Caso:
  extensions:
    - 'TractorCow\Fluent\Extension\FluentExtension'
    - 'TractorCow\Fluent\Extension\FluentFilteredExtension'
# DataObject 2
Reference:
  extensions:
    - 'TractorCow\Fluent\Extension\FluentExtension'
    - 'TractorCow\Fluent\Extension\FluentFilteredExtension'

In Reference.php:

[...]
private static $translate = [
        'Autore',
        'Titolo',
        'Azienda',
        'Commento'
   ];
[...]

    public function getCMSfields()
    {
       [...]
        $fields = FieldList::create(
            TextField::create('Autore', 'Autore'),
            TextField::create('Titolo', 'Titolo'),
            TextField::create('Azienda', 'Azienda'),
            $uploadLogo, // A GridField previously istanced
            TextareaField::create('Commento', 'Commento')
        );

        $this->extend('updateCMSFields', $fields);

        return $fields;
    }

in Reference page relation:

[...]
 private static $translate = [
        'References'
    ];
[...]

(Omitting Caso.php to avoid redondance - It's the same as above)

After running /dev/build?flush=all then try to re-enter DataObject edit page, an exception is thrown:

[User Error] FieldList::addFieldToTab() Tried to add a tab to object 'SilverStripe\Forms\FieldList' - 'Root' didn't exist.

I tried to explicitly set a root tab, but nothing.
After numerous tries, when calling updateCMSfields(FieldList $fields) instead of getCMSfield() the code is compiled and edit the DataObject is allowed. Inside it, i see the Locale/Filterlocale tabs, but both empty. Plus, apparently no DB-splitting of data is set about those fields (if any field is filled then saved, data is copied in both locales).

Any suggestion?

Thanks in advance

@ghost ghost changed the title [DataObject] FieldList Root tab didnt exist [DataObject] Error: FieldList Root tab didnt exist Mar 28, 2018
@ghost ghost changed the title [DataObject] Error: FieldList Root tab didnt exist [DataObject] Error: FieldList Root tab didn't exists Mar 28, 2018
@ghost
Copy link
Author

ghost commented Mar 28, 2018

Found it.

Both declaration of:

- 'TractorCow\Fluent\Extension\FluentExtension'
- 'TractorCow\Fluent\Extension\FluentFilteredExtension'

in yaml configuration, caused the issue. I followed @adder10 example on #207 and removed FluentFilteredExtension. It seems to work now.

@ghost ghost closed this as completed Mar 28, 2018
@ghost
Copy link
Author

ghost commented Mar 29, 2018

I reopened the issue in order to submit the same bug with a little specification. I noticed that it's caused using explicitly - 'TractorCow\Fluent\Extension\FluentFilteredExtension' only, alone or in conjunction with - 'TractorCow\Fluent\Extension\FluentExtension' (still on SS 4.0.3).

@benmanu
Copy link

benmanu commented Jul 10, 2019

Have worked around this issue by going from:

public function getCMSFields()
{
	$fields = FieldList::create(
		// fields
	);

	$this->extend('updateCMSFields', $fields);

	return $fields;
}

to

public function getCMSFields()
{
	$fields = FieldList::create(TabSet::create('Root'));
	$fields->addFieldsToTab(
		'Root.main',
		[
			// fields
		]
	);

	$this->extend('updateCMSFields', $fields);

	return $fields;
}

on the dataobject that was erroring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants