Let's say I had a set of quotes, and I wanted them to display randomly on most of the pages - but wanted a place for them to be managed, what's the best way to do this? Create a special code page called QuotesPageManager.php with a HasManyComplexTableField and remove all the tabs except one that is called 'Quotes Manager' - something like this?
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.
That would be a possibility indeed, see: http://doc.silverstripe.com/doku.php?id=recipes:example_of_quotes_on_a_page
A HasMany or a ComplexTable field for editing would be the way to go - http://doc.silverstripe.com/doku.php?id=complextablefield. If you are planning on having 30 or 40 quotes then you might like to use a ModelAdmin interface but that would be over the top for managing 10 or 20 of them
There likely won't be more than 10 items. I actually have a tab on every Page called 'RelatedLinks'. This is a DataObjectManager that lets each page have it's own <ul><li> of links that relate specifically to that page. However, now I need 'GlobalLinks' that appear the same on every page - to me it doesn't make sense to have a tab on every page called GlobalLinks. In my mind there should only be one place where the user goes to edit this.
So do I create a GlobalLinks.php class and in GlobalLinksPage.php I remove all tabs but my DataObjectManager? Or, do I use modeladmin?
I've tried ModelAdmin but I see this just won't do, because I need the ability to at least have ComplexTableField but Ideally to use DataObjectManager so that I can sort this items. My understanding now of modelAdmin after setting it up (with help from stuckinrealtime on IRC) is that it really is only a data manager and cannot control any view in the CMS.
So it looks like the only option is to create a special page type called GlobalLinks.php and remove all of the tabs on it. Then make a function in Page.php that gets this data for use in my template.
Any feedback welcome.