Reputation: 2800
Is it possible to change the field type for Content
in the db from an extension?
It seems I can't override it like so:
class ParsedownExtension extends DataExtension {
private static $db = array(
'Content' => 'ParsedownField'
);
}
My field type & extension does work because it works fine with a fieldname different to Content
Upvotes: 2
Views: 145
Reputation: 15794
It is possible to change a field type by setting it in your _config.php
file.
mysite/_config.php
$fields = Config::inst()->get('SiteTree', 'db', Config::UNINHERITED);
$fields['Content'] = 'ParsedownField';
Config::inst()->update('SiteTree', 'db', $fields);
This answer was found a question on the Silverstripe Forum:
http://www.silverstripe.org/general-questions/show/23967
Upvotes: 1