This module is now abandoned, for SilverStripe 4 you can use my new and improved version silverstripe-dap
Give DataObjects an own url and a page to display them on.
Add the DataObjectLinkExtension
to your DataObject and the DataObjectLinkExtension_Controller
to your page controller where you want the item to be displayed.
Item:
extensions:
- DataObjectLinkExtension
ItemCategoryPage_Controller:
extensions:
- DataObjectLinkExtension_Controller
DataObjectLinkMapping:
mappings:
produkt:
class: 'Item'
id_instead_of_slug: false
template: 'CoolItemPage'
You need to create a mapping for each URL Action. This action needs to be unique. So in this example, you can't create another one called "produkt" For each action you must define a class (DataObject classname), if you want to use the ID as url segment instead of the slug and you are able to submit a specific template. By default a template called "ClassNamePage" would be used. In this case "ItemPage"
The URL Action must be unique!
public function getHolderPage() {
return $this->Page();
}
If your DataObject is linked to a specific page, you could use this function to provide that page. It will be used in the Link() function. Otherwise the link would be the current page.
You could also use those methods to modify the breadcrumbs per class
- getBreadcrumbsMaxDepth()
- getBreadcrumbsUnlinked()
- getBreadcrumbsStopAtPageType()
- getBreadcrumbsShowHidden()
Don't forget to dev/build after adding the extension to an DataObject
To use the extension points, you need to extend the class and apply your new class instead of the old one. Also your new class needs the same $allowed_actions
and $url_handlers