PHP code example of onesandzeros / silverstripe-timezones
1. Go to this page and download the library: Download onesandzeros/silverstripe-timezones library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
onesandzeros / silverstripe-timezones example snippets
use Spekulatius\TimeZones\Model\FieldType\TimeZone;
use Spekulatius\TimeZones\Forms\TimeZoneField;
class MyPage extends Page
{
/**
* @var array
*/
private static $db = array(
'UserTimeZone' => TimeZone::class
);
/**
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
// ...
$fields->addFieldToTab(
'Root.Main',
TimeZoneField::create(
'TimeZone',
'My time zone'
)
);
return $fields;
}
}