mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge remote-tracking branch 'origin/3.0'
This commit is contained in:
commit
1bf67fd942
@ -1694,25 +1694,13 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
/**
|
/**
|
||||||
* Return the number of {@link DependentPages()}
|
* Return the number of {@link DependentPages()}
|
||||||
*
|
*
|
||||||
|
* @deprecated 3.1 Use DependentPages()->Count() instead.
|
||||||
|
*
|
||||||
* @param $includeVirtuals Set to false to exlcude virtual pages.
|
* @param $includeVirtuals Set to false to exlcude virtual pages.
|
||||||
*/
|
*/
|
||||||
public function DependentPagesCount($includeVirtuals = true) {
|
public function DependentPagesCount($includeVirtuals = true) {
|
||||||
$links = DB::query("SELECT COUNT(*) FROM \"SiteTree_LinkTracking\"
|
Deprecation::notice('3.1', 'Use SiteTree->DependentPages()->Count() instead.');
|
||||||
INNER JOIN \"SiteTree\" ON \"SiteTree\".\"ID\" = \"SiteTree_LinkTracking\".\"SiteTreeID\"
|
return $this->DependentPages($includeVirtuals)->Count();
|
||||||
WHERE \"ChildID\" = $this->ID ")->value();
|
|
||||||
if($includeVirtuals && class_exists('VirtualPage')) {
|
|
||||||
$virtuals = DB::query("SELECT COUNT(*) FROM \"VirtualPage\"
|
|
||||||
INNER JOIN \"SiteTree\" ON \"SiteTree\".\"ID\" = \"VirtualPage\".\"ID\"
|
|
||||||
WHERE \"CopyContentFromID\" = $this->ID")->value();
|
|
||||||
} else {
|
|
||||||
$virtuals = 0;
|
|
||||||
}
|
|
||||||
$redirectors = DB::query("SELECT COUNT(*) FROM \"RedirectorPage\"
|
|
||||||
INNER JOIN \"SiteTree\" ON \"SiteTree\".\"ID\" = \"RedirectorPage\".\"ID\"
|
|
||||||
WHERE \"RedirectionType\" = 'Internal' AND \"LinkToID\" = $this->ID")->value();
|
|
||||||
|
|
||||||
|
|
||||||
return 0 + $links + $virtuals + $redirectors;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1788,7 +1776,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
$dependentTable = new LiteralField('DependentNote', '<p></p>');
|
$dependentTable = new LiteralField('DependentNote', '<p></p>');
|
||||||
|
|
||||||
// Create a table for showing pages linked to this one
|
// Create a table for showing pages linked to this one
|
||||||
$dependentPagesCount = $this->DependentPagesCount();
|
$dependentPages = $this->DependentPages();
|
||||||
|
$dependentPagesCount = $dependentPages->Count();
|
||||||
if($dependentPagesCount) {
|
if($dependentPagesCount) {
|
||||||
$dependentColumns = array(
|
$dependentColumns = array(
|
||||||
'Title' => $this->fieldLabel('Title'),
|
'Title' => $this->fieldLabel('Title'),
|
||||||
@ -1801,7 +1790,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
$dependentTable = GridField::create(
|
$dependentTable = GridField::create(
|
||||||
'DependentPages',
|
'DependentPages',
|
||||||
false,
|
false,
|
||||||
$this->DependentPages()
|
$dependentPages
|
||||||
);
|
);
|
||||||
$dependentTable->getConfig()->getComponentByType('GridFieldDataColumns')
|
$dependentTable->getConfig()->getComponentByType('GridFieldDataColumns')
|
||||||
->setFieldFormatting(array(
|
->setFieldFormatting(array(
|
||||||
|
@ -20,10 +20,10 @@ Feature: Edit a page
|
|||||||
Then I should see an edit page form
|
Then I should see an edit page form
|
||||||
|
|
||||||
When I fill in "Title" with "About Us!"
|
When I fill in "Title" with "About Us!"
|
||||||
And I fill in the content form with "my new content"
|
And I fill in the "Content" HTML field with "my new content"
|
||||||
And I press the "Save Draft" button
|
And I press the "Save Draft" button
|
||||||
Then I should see a "Saved." notice
|
Then I should see a "Saved." notice
|
||||||
|
|
||||||
When I follow "About Us"
|
When I follow "About Us"
|
||||||
Then the "Title" field should contain "About Us!"
|
Then the "Title" field should contain "About Us!"
|
||||||
And the content form should contain "my new content"
|
And the "Content" HTML field should contain "my new content"
|
@ -25,7 +25,7 @@ Feature: Preview a page
|
|||||||
Then I should see "About Us" in CMS Tree
|
Then I should see "About Us" in CMS Tree
|
||||||
|
|
||||||
When I follow "About Us"
|
When I follow "About Us"
|
||||||
And I fill in the content form with "my new content"
|
And I fill in the "Content" HTML field with "my new content"
|
||||||
And I press the "Save Draft" button
|
And I press the "Save Draft" button
|
||||||
And I press the "Preview »" button
|
And I press the "Preview »" button
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user