Silverstripe 4.1
Question:
I add extra settings to the siteconfig unto a new tab, but was wondering if you can group settings.
For example.
I have 3 settings for the header compenent.
4 settings for the content.
Can I make them into a group by using a header text for example?
Currently I created the extra settings via the following code:
use SilverStripe\ORM\DataExtension;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\CheckboxField;
use SilverStripe\AssetAdmin\Forms\UploadField;
use SilverStripe\Assets\Image;
class SentConfig extends DataExtension {
private static $db = [
'PoweredBy' => 'Varchar',
'PoweredByLink' => 'Varchar',
'ShowTopFooter' => 'Boolean',
'ShowSeachBoxHeader' => 'Boolean',
'headline' => 'Varchar',
'fullWidthContent' => 'Boolean'
];
private static $has_one = [
'TopBGImage' => Image::class,
];
public function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab("Root.Layout", CheckboxField::create("fullWidthContent", "Content at full width when checked"));
$fields->addFieldToTab("Root.Layout", CheckboxField::create("ShowTopFooter", "Show the top footer block"));
$fields->addFieldToTab("Root.Layout", $topbgimage = UploadField::create("TopBGImage", "Background Image for top"));
$topbgimage->setFolderName("theme-images");
$fields->addFieldToTab("Root.Layout", TextField::create("headline", "Add headline text"));
$fields->addFieldToTab("Root.Layout", CheckboxField::create("ShowSeachBoxHeader", "Show the searchbox inside the header"));
$fields->addFieldToTab("Root.Main", TextField::create("PoweredBy", "Powered by"));
$fields->addFieldToTab("Root.Main", TextField::create("PoweredByLink", "Powered by link"));
}
}
Cheers,