2012-03-25 18:35:01 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class SubsiteDomain extends DataObject {
|
2013-05-06 12:21:09 +02:00
|
|
|
|
2013-11-14 21:48:38 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
2013-05-06 12:21:09 +02:00
|
|
|
private static $db = array(
|
2012-03-25 18:35:01 +02:00
|
|
|
"Domain" => "Varchar(255)",
|
|
|
|
"IsPrimary" => "Boolean",
|
|
|
|
);
|
2013-05-06 12:21:09 +02:00
|
|
|
|
2013-11-14 21:48:38 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
2013-05-06 12:21:09 +02:00
|
|
|
private static $has_one = array(
|
2012-03-25 18:35:01 +02:00
|
|
|
"Subsite" => "Subsite",
|
|
|
|
);
|
2013-05-06 12:21:09 +02:00
|
|
|
|
2013-11-14 21:48:38 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
2013-05-06 12:21:09 +02:00
|
|
|
private static $summary_fields=array(
|
2013-10-30 13:43:59 +01:00
|
|
|
'Domain',
|
|
|
|
'IsPrimary',
|
2012-07-10 15:43:53 +02:00
|
|
|
);
|
2013-05-06 12:21:09 +02:00
|
|
|
|
2012-03-25 18:35:01 +02:00
|
|
|
/**
|
|
|
|
* Whenever a Subsite Domain is written, rewrite the hostmap
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function onAfterWrite() {
|
|
|
|
Subsite::writeHostMap();
|
|
|
|
}
|
2012-07-10 15:43:53 +02:00
|
|
|
|
2013-11-14 21:48:38 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @return \FieldList
|
|
|
|
*/
|
2012-07-10 15:43:53 +02:00
|
|
|
public function getCMSFields() {
|
2013-11-14 21:47:44 +01:00
|
|
|
$fields = new FieldList(
|
2013-10-30 13:43:59 +01:00
|
|
|
new TextField('Domain', $this->fieldLabel('Domain'), null, 255),
|
|
|
|
new CheckboxField('IsPrimary', $this->fieldLabel('IsPrimary'))
|
2012-07-11 15:32:10 +02:00
|
|
|
);
|
2013-11-14 21:47:44 +01:00
|
|
|
$this->extend('updateCMSFields', $fields);
|
|
|
|
return $fields;
|
2012-07-10 15:43:53 +02:00
|
|
|
}
|
2013-10-30 13:43:59 +01:00
|
|
|
|
2013-11-14 21:48:38 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param bool $includerelations
|
|
|
|
* @return array
|
|
|
|
*/
|
2013-10-30 13:43:59 +01:00
|
|
|
public function fieldLabels($includerelations = true) {
|
|
|
|
$labels = parent::fieldLabels($includerelations);
|
|
|
|
$labels['Domain'] = _t('SubsiteDomain.DOMAIN', 'Domain');
|
|
|
|
$labels['IsPrimary'] = _t('SubsiteDomain.IS_PRIMARY', 'Is Primary Domain');
|
|
|
|
|
|
|
|
return $labels;
|
|
|
|
}
|
2013-04-30 07:53:09 +02:00
|
|
|
}
|