Removed dependency for translatable module

This commit is contained in:
micmania1 2016-03-03 22:38:37 +00:00
parent 2734f1a18e
commit 7c5f29ce19

View File

@ -91,7 +91,7 @@ class CMSPageAddController extends CMSPageEditController {
// TODO Re-enable search once it allows for HTML title display, // TODO Re-enable search once it allows for HTML title display,
// see http://open.silverstripe.org/ticket/7455 // see http://open.silverstripe.org/ticket/7455
// $parentField->setShowSearch(true); // $parentField->setShowSearch(true);
$parentModeField->addExtraClass('parent-mode'); $parentModeField->addExtraClass('parent-mode');
// CMSMain->currentPageID() automatically sets the homepage, // CMSMain->currentPageID() automatically sets the homepage,
@ -102,7 +102,7 @@ class CMSPageAddController extends CMSPageEditController {
} else { } else {
$parentModeField->setValue('top'); $parentModeField->setValue('top');
} }
$actions = new FieldList( $actions = new FieldList(
FormAction::create("doAdd", _t('CMSMain.Create',"Create")) FormAction::create("doAdd", _t('CMSMain.Create',"Create"))
->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept') ->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')
@ -111,9 +111,9 @@ class CMSPageAddController extends CMSPageEditController {
->addExtraClass('ss-ui-action-destructive ss-ui-action-cancel') ->addExtraClass('ss-ui-action-destructive ss-ui-action-cancel')
->setUseButtonTag(true) ->setUseButtonTag(true)
); );
$this->extend('updatePageOptions', $fields); $this->extend('updatePageOptions', $fields);
$form = CMSForm::create( $form = CMSForm::create(
$this, "AddForm", $fields, $actions $this, "AddForm", $fields, $actions
)->setHTMLID('Form_AddForm'); )->setHTMLID('Form_AddForm');
@ -140,7 +140,7 @@ class CMSPageAddController extends CMSPageEditController {
if(is_numeric($parentID) && $parentID > 0) $parentObj = DataObject::get_by_id("SiteTree", $parentID); if(is_numeric($parentID) && $parentID > 0) $parentObj = DataObject::get_by_id("SiteTree", $parentID);
else $parentObj = null; else $parentObj = null;
if(!$parentObj || !$parentObj->ID) $parentID = 0; if(!$parentObj || !$parentObj->ID) $parentID = 0;
if(!singleton($className)->canCreate(Member::currentUser(), array('Parent' => $parentObj))) { if(!singleton($className)->canCreate(Member::currentUser(), array('Parent' => $parentObj))) {
@ -148,9 +148,7 @@ class CMSPageAddController extends CMSPageEditController {
} }
$record = $this->getNewItem("new-$className-$parentID".$suffix, false); $record = $this->getNewItem("new-$className-$parentID".$suffix, false);
if(class_exists('Translatable') && $record->hasExtension('Translatable') && isset($data['Locale'])) { $this->extend('updateDoAdd', $record, $form);
$record->Locale = $data['Locale'];
}
try { try {
$record->write(); $record->write();
@ -167,7 +165,7 @@ class CMSPageAddController extends CMSPageEditController {
_t('CMSMain.PageAdded', 'Successfully created page') _t('CMSMain.PageAdded', 'Successfully created page')
); );
Session::set("FormInfo.Form_EditForm.formError.type", 'good'); Session::set("FormInfo.Form_EditForm.formError.type", 'good');
return $this->redirect(Controller::join_links(singleton('CMSPageEditController')->Link('show'), $record->ID)); return $this->redirect(Controller::join_links(singleton('CMSPageEditController')->Link('show'), $record->ID));
} }