Using SilverStripe 3 when in the CMS looking at draft preview mode I get the following error:
[User Error] Uncaught Exception: Object->__call(): the method 'featuredimage' does not exist on 'PortfolioPage'
This only happens in draft mode, not in published mode. I'm confused as to why. It is fine on the front end and does what it is supposed to but throws the error in draft.
PortfolioPage.ss
<div class="content-container unit size3of4 lastUnit">
<article>
<div class="content">
$Content
<div id="container">
<% loop $DescendantFeaturedImages %>
<% if $FeaturedImage %>
<div class="item $Parent.URLSegment">
<a href="$Link" title="$Parent.Title - $Title">
<img src="$FeaturedImage.URL" width="100%" />
<div id="mask">
<span class="TitleContainer">
<h4>$Parent.Title</h4>
<p>$Title</p>
</span>
</div>
</a>
</div>
<% end_if %>
<% end_loop %>
<div>
</div>
</article>
$Form
$PageComments
</div>
PortfolioPage.php
class PortfolioPage extends Page {
}
class PortfolioPage_Controller extends Page_Controller {
public function init() {
parent::init();
Requirements::css( 'gallery/css/gallerystyles.css' );
}
function DescendantFeaturedImages() {
$featuredImages = array();
foreach ( $this->Children() as $child ) {
foreach ( $child->Children() as $grandChild ) {
$image = $grandChild->FeaturedImage();
if ( $image ) {
array_push( $featuredImages, $grandChild );
}
}
}
shuffle( $featuredImages );
return ArrayList::create( $featuredImages );
}
}

FeaturedImagecome from? Is this in Page.php? - 3dgoo