mirror of
https://github.com/a2nt/silverstripe-webpack.git
synced 2024-10-22 15:05:31 +00:00
41 lines
1005 B
PHP
Executable File
41 lines
1005 B
PHP
Executable File
<?php
|
|
|
|
use SilverStripe\ORM\DataExtension;
|
|
use SilverStripe\CMS\Model\SiteTree;
|
|
use SilverStripe\Forms\FieldList;
|
|
use SilverStripe\Forms\TreeMultiselectField;
|
|
use Sheadawson\Linkable\Models\Link;
|
|
use SilverStripe\Forms\TextField;
|
|
use Sheadawson\Linkable\Forms\LinkField;
|
|
|
|
class SiteConfigExtension extends DataExtension
|
|
{
|
|
private static $db = [
|
|
'Address' => 'Varchar(255)',
|
|
];
|
|
|
|
private static $has_one = [
|
|
'PhoneNumber' => Link::class
|
|
];
|
|
|
|
private static $many_many = [
|
|
'Navigation' => SiteTree::class
|
|
];
|
|
|
|
public function updateCMSFields(FieldList $fields)
|
|
{
|
|
$tab = $fields->findOrMakeTab('Root.Main');
|
|
|
|
$tab->push(TreeMultiselectField::create(
|
|
'Navigation',
|
|
'Navigation',
|
|
SiteTree::class
|
|
));
|
|
$tab->push(
|
|
LinkField::create('PhoneNumberID', 'Phone Number')
|
|
->setAllowedTypes(['Phone'])
|
|
);
|
|
$tab->push(TextField::create('Address'));
|
|
}
|
|
}
|