Closed jedateach closed 10 years ago
@jedateach Maybe changing line 29 in BetterNavigator.php from
if($this->owner && $this->owner->dataRecord)
to if($this->owner && $this->owner->dataRecord && $this->owner->ID > 0)
would help? Can you let me know if this works? Would prevent the navigator being shown though.
@jonom: Turns out I diagnosed this slightly wrong.
The error is thrown when dataRecord is a class that doesn't implement CMSPreviewable
, in this case ViewableData_Customised
.
This works as a fix, but also hides the navigator.
if($this->owner && $this->owner->dataRecord && $this->owner->dataRecord instanceof SiteTree) {
I still think this is something that needs to be resolved in SilverStripeNavigator
.
Some controllers don't have an associated model, such as when registering for an event using the eventregistration module. It constructs a controller with no associated page. The navigator breaks in these cases.
Mind you, this appears to be an issue with the default SilverStripeNavigator.