Hi,
I'm making a simple widget to allow me to link to a page, with a simple description. This will only be on some pages.
To keep this in one area of the CMS so I can alter the text globally I have put the fields into CustomSiteConfig.
However, I can't get widgets to access the data using $SiteConfig.XX
If I put the same code directly into page.ss it works fine.
<?php
class CustomSiteConfig extends DataObjectDecorator {
function extraStatics() {
return array(
'db' => array(
'WidgetDescription => 'Text'
)
,
'has_one' => array(
'WidgetLink' => 'SiteTree'
)
);
}
public function updateCMSFields(FieldSet &$fields) {
$fields->addFieldToTab("Root.Main", new TextField('WidgetDescription', 'Widget Description'));
$fields->addFieldToTab('Root.Main', new TreeDropdownField("WidgetLinkID", "Widget Link", "SiteTree"));
}
}
Thank you for reading.