Fixed regression in SiteTree->getCMSActions()

Caused by toolbar recent changes
This commit is contained in:
Ingo Schommer 2012-12-14 01:11:52 +01:00
parent 1d470fe718
commit 74d63791b7
2 changed files with 8 additions and 3 deletions

View File

@ -2087,6 +2087,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$moreOptions->push(FormAction::create('email', _t('CMSMain.EMAIL', 'Email')));
$moreOptions->push(FormAction::create('rollback', _t('CMSMain.ROLLBACK', 'Roll back to this version')));
$actions = new FieldList(array($majorActions, $rootTabSet));
// getCMSActions() can be extended with updateCMSActions() on a extension
$this->extend('updateCMSActions', $actions);
@ -2163,10 +2165,12 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
}
}
$actions = new FieldList(array($majorActions, $rootTabSet));
// Hook for extensions to add/remove actions.
$this->extend('updateCMSActions', $actions);
return new FieldList(array($majorActions, $rootTabSet));
return $actions;
}
/**

View File

@ -182,9 +182,10 @@ class CMSMainTest extends FunctionalTest {
$parentPage->doUnpublish();
$childPage->doUnpublish();
$this->assertContains(
$actions = $childPage->getCMSActions()->dataFields();
$this->assertArrayHasKey(
'action_publish',
$childPage->getCMSActions()->column('Name'),
$actions,
'Can publish a page with an unpublished parent with strict hierarchy off'
);
SiteTree::set_enforce_strict_hierarchy(false);