746 Posts in 310 Topics by 289 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 323 Views |
-
Render form in widget called with renderWith() from Page class

29 September 2012 at 9:41pm
Hi all,
I hope the title says it all, but my problem is as follows. A page contains several different widgets, which I use for pagination, so one widgetblock should represent one page content. I currently read the correct item using
// Inside Page.php
$widget = $this->WidgetArea()->Widgets("Sort = {$page}")->first();Where $page is the page number (ie, 0, 1, ...)
Now, I render this widget with the proper template using:
// Inside same method in Page.php
$content = $widget->renderWith(array($class, 'Widget'), array());
return new ArrayData(array(
'Response' => $content
));Where $class is the (verified) classname of the widget.
So far so good, except that this will not render any forms on the template of the widget, as I think, because calling $WidgetForm (defined on WidgetClassName_Controller) is actually looking for a method WidgetForm() on Page.php. How can I tell SilverStripe to use WidgetClassName_Controller instead?
Friendly regards,
Maurice
| 323 Views | ||
|
Page:
1
|
Go to Top |

