mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
MINOR Custom meta tags on SubsiteVirtualPages no longer get overwritten. (from r87329)
This commit is contained in:
parent
625ab4e235
commit
93afe6e6ff
@ -73,6 +73,8 @@ class SubsitesVirtualPage extends VirtualPage {
|
|||||||
if($v == 'SubsiteID') unset($fields[$k]);
|
if($v == 'SubsiteID') unset($fields[$k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach(self::$db as $field => $type) if (in_array($field, $fields)) unset($fields[array_search($field, $fields)]);
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ SiteTree:
|
|||||||
SubsiteID: =>Subsite_Template.main
|
SubsiteID: =>Subsite_Template.main
|
||||||
linky:
|
linky:
|
||||||
Title: Linky
|
Title: Linky
|
||||||
|
MetaTitle: Linky
|
||||||
SubsiteID: =>Subsite_Template.main
|
SubsiteID: =>Subsite_Template.main
|
||||||
staff:
|
staff:
|
||||||
Title: Staff
|
Title: Staff
|
||||||
|
@ -163,4 +163,35 @@ class SubsitesVirtualPageTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test custom metadata. Reloading Content should not
|
||||||
|
* obliterate our custom fields
|
||||||
|
*/
|
||||||
|
function testCustomMetadata() {
|
||||||
|
Subsite::$write_hostmap = false;
|
||||||
|
|
||||||
|
$subsite = $this->objFromFixture('Subsite_Template', 'main');
|
||||||
|
|
||||||
|
Subsite::changeSubsite($subsite->ID);
|
||||||
|
|
||||||
|
$orig = $this->objFromFixture('SiteTree', 'linky');
|
||||||
|
|
||||||
|
$svp = new SubsitesVirtualPage();
|
||||||
|
$svp->CopyContentFromID = $orig->ID;
|
||||||
|
$svp->SubsiteID = $subsite->ID;
|
||||||
|
$svp->URLSegment = 'linky-'.rand();
|
||||||
|
$svp->write();
|
||||||
|
|
||||||
|
$this->assertEquals($svp->MetaTitle, 'Linky');
|
||||||
|
|
||||||
|
$svp->CustomMetaTitle = 'SVPTitle';
|
||||||
|
$svp->write();
|
||||||
|
$this->assertEquals($svp->MetaTitle, 'SVPTitle');
|
||||||
|
|
||||||
|
$svp->copyFrom($svp->CopyContentFrom());
|
||||||
|
$svp->write();
|
||||||
|
|
||||||
|
$this->assertEquals($svp->MetaTitle, 'SVPTitle');
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user