Toptabbers

Latest 4.4.4

Updating site from 3 to above. bottom menu update.

$fields->addFieldToTab(‘Root.Main’, new CheckboxField(‘ShowInTabMenu’, ‘Page shows in middle menu blocks’));

function topTabbers() {
$whereStatement = ‘ShowInTabMenu = 1 AND ShowInMenus = 1’;
return DataObject::get(‘Page’, $whereStatement, ‘SortMenu ASC’);
}

In SS3 I used the code to add certain pages to this 2nd menu with check box in CMS but in 4 this error comes up.

[Emergency] Uncaught Error: Class ‘DataObject’ not found

Any idea what needs to be done.

I’m guessing there’s a missing use SilverStripe\ORM\DataObject; from the top of the file.

That said, I’d probably just update the query to use a bit more of the ORM features:

return Page::get()->filter(['ShowInTabMenu' => 1, 'ShowInMenus' => 1])->sort('SortMenu');