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

TreeDropdownField doesn't work with Widget::getCMSFields() #26

Open
MattyBalaam opened this issue Nov 1, 2012 · 6 comments
Open

TreeDropdownField doesn't work with Widget::getCMSFields() #26

MattyBalaam opened this issue Nov 1, 2012 · 6 comments
Labels

Comments

@MattyBalaam
Copy link
Contributor

No description provided.

@spierala
Copy link

same here. i get this error:
Fatal error: Call to a member function FormAction() on a non-object in FormField.php on line 139

@MattyBalaam
Copy link
Contributor Author

Hi, if you see here you can see more details about this issue: #20

The best solution I have come up with so far is on this thread: http://www.silverstripe.org/widgets-2/show/20865

@Bob-Plastyk
Copy link

It would be great to have TreeDropdownField for Widgets.

@christopherdarling
Copy link
Contributor

There's a good extension you can use to manage widgets via a GridField in SS3, so you can use UploadField's and TreeDropdownField's etc too - https://github.com/g4b0/silverstripe-widget-pages-extension

@mlewis-everley
Copy link

I have done some digging into this issue, it appears that TreeDropdownField is unaware of what form it is being added to. Widget::getCMSFields() doesn't seem to use TreeDropdownField::setForm() correctly and so this error is raised.

You can manually set the form in your getCMSFields function, but I am not sure how to get the current Form from the CMS (Controller::curr()->EditForm() causes a different error).

I have kind of gotten stuck at this point, I guess the best solution would be for Widgets to setForm correctly on fields such as TreeDropdownField, UploadField, etc, not really sure how though.

@mlewis-everley
Copy link

I have just done a little more digging, I think the issue can be tracked down to something inside this loop:

https://github.com/silverstripe/silverstripe-widgets/blob/master/src/Model/Widget.php#L202

If I have time later today, I may try and have a play around, see if I can work our what is causing it...

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

No branches or pull requests

5 participants