本文整理汇总了PHP中Subsite::write方法的典型用法代码示例。如果您正苦于以下问题:PHP Subsite::write方法的具体用法?PHP Subsite::write怎么用?PHP Subsite::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subsite
的用法示例。
在下文中一共展示了Subsite::write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doCreate
function doCreate($data, $form, $request)
{
if (isset($data['TemplateID']) && $data['TemplateID']) {
$template = DataObject::get_by_id('Subsite_Template', $data['TemplateID']);
} else {
$template = null;
}
// Create subsite from existing template
switch ($data['Type']) {
case 'template':
if ($template) {
$subsite = $template->duplicate();
} else {
$subsite = new Subsite_Template();
$subsite->write();
}
break;
case 'subsite':
default:
if ($template) {
$subsite = $template->createInstance($data['Title']);
} else {
$subsite = new Subsite();
$subsite->Title = $data['Title'];
$subsite->write();
}
break;
}
$form->dataFieldByName('Domains')->setExtraData(array("SubsiteID" => $subsite->ID));
$form->saveInto($subsite);
$subsite->write();
if (Director::is_ajax()) {
$recordController = new ModelAdmin_RecordController($this, $request, $subsite->ID);
return new SS_HTTPResponse($recordController->EditForm()->forAjaxTemplate(), 200, sprintf(_t('ModelAdmin.LOADEDFOREDITING', "Loaded '%s' for editing."), $subsite->Title));
} else {
Director::redirect(Controller::join_links($this->Link(), $subsitess->ID, 'edit'));
}
}
示例2: createSubsiteWithDomains
protected function createSubsiteWithDomains($domains)
{
$subsite = new Subsite(array('Title' => 'My Subsite'));
$subsite->write();
foreach ($domains as $domainStr => $isPrimary) {
$domain = new SubsiteDomain(array('Domain' => $domainStr, 'IsPrimary' => $isPrimary, 'SubsiteID' => $subsite->ID));
$domain->write();
}
return $subsite;
}