7956 Posts in 1394 Topics by 945 members
|Go to End|
6 September 2010 at 10:25pm
In Site Config, do you still need to use;
or is it just;
What about if using it from another object decorator?
7 September 2010 at 1:39am
Probably not. If you have a corresponding $has_many and $has_one, you shouldn't need any of that. Maybe the sourceID() call.. cause I know SiteConfig is a bit of a different animal.
4 January 2012 at 12:55am
For your information, I had to add the setSourceID call for this to work.
Thanks again, UncleCheese!
22 February 2012 at 10:02pm
The solution offered in this topic works for me, but somehow not totally:
In my customsiteconfig.php i have this code:
$manager = new DataObjectManager(
'Quote' => 'Quote'
Then, in my Quote.php i have:
class Quote extends DataObject
static $db = array (
'Quote' => 'HTMLText'
static $has_one = array (
'SiteConfig' => 'SiteConfig'
public function getCMSFields_forPopup()
return new FieldSet(
I use this on a multilanguage site, so in my _config.php i have:
At first, the dataobjectmanager loads the items for the language that has been selected. When I click the "add quote" button and click away or save, the dataobjectmanager loads the items for the default language. Somehow, it loses the reference to the loaded siteconfig. Does anyone else have troubles with DOM in CustomSiteConfig with multiple languages?
22 February 2012 at 10:26pm
it seems the siteconfig and locale stuff doesn't work very well. I hacked the DataObjectManager class in the following way, and now it works:
public function Link($action = null)
public function BaseLink()
2 March 2012 at 2:14am
I'm currently having a battle with SiteConfig ...
FYI: I found that I had to do what Juanitou did and also add "$manager->setSourceID($this->owner->ID);" to get a complete solution: add items, retrieve component set.
Without the setSourceID() call, any query on a 'has_many' set (i.e. SiteConfig::current_site_config()->MyHasManyItems()) would return an empty ComponentSet; even though in the CMS I could see all the items.
22 January 2013 at 5:01am Last edited: 22 January 2013 5:20am
|Go to Top|