I have created DataObject and ModelAdmin class for Product as shown here http://doc.silverstripe.org/en/developer_guides/customising_the_admin_interface/modeladmin
which works fine in Main Site, but it is now showing in admin menu of Subsite.
How do I access same Product data for Subsite?
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.
If there is nothing provided (or an already existing addon), you will need to subclass ModelAdmin, then edit the list getter to filter on site ID.
Your objects will also of course need to be associated with a site (like pages do when you install subsites, normal data objects however do not).
The solution is quite simple: you need to apply `SubsiteMenuExtension` to your ModelAdmin, e.g. in your config.yml:
MyModelAdminAdmin:
extensions:
- SubsiteMenuExtension
Thanks Pyromanik adn wmk for your support.
Second option is really better and easy. but instead of mention config.yml, I had write the code
MyModelAdmin::add_extension('SubsiteMenuExtension');
in _config.php and it works.
After editing YML you must flush before changes will take effect :)