Silverstripe 2.4 default value textareafield CustomSiteConfig -
How can the default value for textareafield be set in CustomSiteConfig? This does not work:
class extends CustomSiteConfig DataObjectDecorator {function additional statics () {return array ('db' = & gt; array ('MyText' = & gt; 'Text') , 'Default' = & gt; array ('MyText' => gt; blah blah), 'is_on' => array ('logo' => 'image')); } Public function update cmsfield (field set $ field) {$ fields- & gt; AddFieldToTab ("root. Main", new text array ("MyText", "My Text")); $ Fields- & gt; AddFieldToTab ("Root.Main", New ImageField ('Logo', 'Logo')); } If the stability does not work, then it is possible that it is untested (2.4 of the). Snippet can help far away: public function populate defaults () {parent: populate default (); $ This- & gt; Owner- & gt; MyText = 'Bla Bla'; }
Comments
Post a Comment