Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

SOLVED - Custom DataObjects with no Title field - CMS Breadcrumb issue


Go to End


2 Posts   1181 Views

Avatar
Double-A-Ron

Community Member, 607 Posts

22 January 2017 at 6:00pm

Edited: 22/01/2017 6:03pm

I'm creating a multi-level relationship between data objects which is managed by ModelAdmin. High level is as follows. All extend DataObject, and non have a need for a Title field, especially the last two.

Tour
    TourItinerary
        TourItineraryStep

All is working well except for Breadcrumbs in the CMS.

The issue is that it appears that Breadcrumbs are hardcoded to look for a field called "Title". If it's not there, it falls back to "ID". So in my case, the breadcrumb for the 3rd TourItineraryStep of the first TourItinerary of the second Tour looks like this:

Tours / #2 / #1 / #3

Is there a way to set a substitute for "Title" references or override the CMS breadcrumbs per object? I've flicked through the DataObject class and can't see anything obvious.

Avatar
Double-A-Ron

Community Member, 607 Posts

22 January 2017 at 6:15pm

I need more coffee. This is easy. I just added this to any DataObjects that I don't want actual Title fields on:

public function getTitle() {
        // The value you I want to show as a substitute for a real Title field
        return $this->TourName;
}