5099 Posts in 1519 Topics by 1116 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 265 Views |
-
Making SiteConfig versioned

7 December 2012 at 8:57pm Last edited: 8 December 2012 1:05pm
I asked about this on IRC. I finally succeeded in customizing my SiteConfig in SilverStripe 3.0.2, and I am trying to make it versioned as well. I have the following lines in mysite/_config.php:
Object::add_extension('SiteConfig', 'Versioned("Stage","Live")');
Object::add_extension('SiteConfig','CustomSiteConfig');My database now has the following tables:
SiteConfig, SiteConfig_CreateTopLevelGroups, SiteConfig_EditorGroups, SiteConfig_Live, SiteConfig_ViewerGroups, and SiteConfig_versionsThe SiteConfig_versions table indeed has a couple of old versions of my SiteConfig. However, only the "Save" button appears in the UI, and I cannot save a draft, and there is no preview option to view the home page with the new siteconfig before I save it... Does anyone have suggestions?
EDIT: It looks like I need to write the function "updateCMSActions()" in my CustomSiteConfig extension to specify these actions.
EDIT #2: but all these actions are hard-coded in getCMSActions() in cms/code/model/SiteTree.php, so I need to rewrite as much of that functionality as I want from scratch, since SiteConfig is not part of SiteTree, and in particular, it should not be possible to delete the SiteConfig from the site.
-
Re: Making SiteConfig versioned

8 December 2012 at 4:35pm
Thanks for your work on this Justin! I would think that SiteConfig should be versioned out of the box so perhaps submit your ideas and work (once you have it working) as a pull request. If it's not something everyone else is interested it, would be a handy module!
-
Re: Making SiteConfig versioned

9 December 2012 at 11:11pm Last edited: 9 December 2012 11:13pm
Ok, I made a "Save & Publish" button appear in the SiteConfig (in addition to the "Save" button---which actually only saves a draft, contrary to my earlier post) by declaring the following function in my CustomSiteConfig.php
public function updateCMSActions(FieldList $actions) {
$actions->push( FormAction::create(
'publish', _t('CMSMain.BUTTONSAVEPUBLISH', 'Save & Publish') )
->addExtraClass('ss-ui-action-constructive')
->setAttribute('data-icon', 'accept')
);
}
So I need to figure out how to make a button like this actually do something in SilverStripe...because now clicking that button generates a "not found" error, because there's apparently no code to handle such an action at present.
| 265 Views | ||
|
Page:
1
|
Go to Top |


