I am new to silverstripe and just tried to add a new page type which will allow me to fetch content from a remote page.
So, I added the following to mysite/code/RemoteContentPage.php
<?php
class RemoteContentPage extends Page {
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->replaceField('Content', new TextField('Content', 'URL to Remote Content')); // we abuse the content Field now to save the URL, we could do another DB Field, but since we already have Content ...
}
function Content() {
$Text = 'hejsan paag';
return $Text;
}
}
class RemoteContentPage_Controller extends Page_Controller {
}
?>
Then I ran /dev/build?flush=1 and tried to create a new remote content page.
Here the backend crashed and I received an alert box that something went wrong (what was not visible in any apache log files).
After that I refreshed the backend by reloading my browser and now the backend page tree menu started to grow indefinitely, adding empty rows to itself and then performing a new request in a infinite loop.
When I removed RemoteContentPage.php from mysite/code and ran /dev/build again, remoteContentPage was still available in the /dev/build output and the backend crashes in the same way. Logout/Login from the backend did not help either.
Will clear all cookies and retry. What did I do wrong when trying to add a new page type?