Silverstripe Version: 4.*
How can I add a field to “blogcategory” table?
Blogcategory table includes URLSegment field which changes according to Title. The problem is that the Title contains non url friendly characters like (šđč ćžäü). I need another field that keeps the correct characters like the Title does - once that is set. This field would than be used for a custom filter on frontend. For now I tried like this but it doesn’t do the trick. Should I rename the class? How can I tell Silverstripe which table to use?
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\DataExtension;
class BlogCategoryExtension extends DataExtension {
private static $db = [
'SafeUrlSegment' => 'String'
];
public function updateCMSFields(FieldList $fields)
{
$fields->push(new TextField('SafeUrlSegment', 'Safe URL Segment'));
}
}