mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge branch '4.4' into 4
This commit is contained in:
commit
ac123ee700
@ -29,7 +29,7 @@ class OldPageRedirector extends Extension
|
|||||||
$getvars = $request->getVars();
|
$getvars = $request->getVars();
|
||||||
unset($getvars['url']);
|
unset($getvars['url']);
|
||||||
|
|
||||||
$page = self::find_old_page($params);
|
$page = static::find_old_page($params);
|
||||||
$cleanPage = trim(Director::makeRelative($page), '/');
|
$cleanPage = trim(Director::makeRelative($page), '/');
|
||||||
if (!$cleanPage) {
|
if (!$cleanPage) {
|
||||||
$cleanPage = Director::makeRelative(RootURLController::get_homepage_link());
|
$cleanPage = Director::makeRelative(RootURLController::get_homepage_link());
|
||||||
|
@ -128,14 +128,7 @@ abstract class SilverStripeNavigatorItem extends ViewableData
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($record->_cached_isArchived)) {
|
if (!isset($record->_cached_isArchived)) {
|
||||||
$baseClass = $record->baseClass();
|
$record->_cached_isArchived = $record->isArchived();
|
||||||
$currentDraft = Versioned::get_by_stage($baseClass, Versioned::DRAFT)->byID($record->ID);
|
|
||||||
$currentLive = Versioned::get_by_stage($baseClass, Versioned::LIVE)->byID($record->ID);
|
|
||||||
|
|
||||||
$record->_cached_isArchived = (
|
|
||||||
(!$currentDraft || ($currentDraft && $record->Version != $currentDraft->Version))
|
|
||||||
&& (!$currentLive || ($currentLive && $record->Version != $currentLive->Version))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $record->_cached_isArchived;
|
return $record->_cached_isArchived;
|
||||||
|
@ -491,6 +491,19 @@ class VirtualPage extends Page
|
|||||||
return $copy && $copy->exists() && $copy->hasField($field);
|
return $copy && $copy->exists() && $copy->hasField($field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $method
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function hasMethod($method)
|
||||||
|
{
|
||||||
|
if (parent::hasMethod($method)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
$copy = $this->CopyContentFrom();
|
||||||
|
return $copy && $copy->exists() && $copy->hasMethod($method);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field
|
* Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field
|
||||||
* on this object.
|
* on this object.
|
||||||
|
@ -669,6 +669,9 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
{
|
{
|
||||||
/** @var VirtualPage $virtualPage */
|
/** @var VirtualPage $virtualPage */
|
||||||
$virtualPage = $this->objFromFixture(VirtualPage::class, 'vp4');
|
$virtualPage = $this->objFromFixture(VirtualPage::class, 'vp4');
|
||||||
|
$this->assertTrue($virtualPage->hasMethod('modelMethod'));
|
||||||
|
$this->assertEquals('hi there', $virtualPage->modelMethod());
|
||||||
|
|
||||||
/** @var VirtualPageTest_ClassAController $controller */
|
/** @var VirtualPageTest_ClassAController $controller */
|
||||||
$controller = ModelAsController::controller_for($virtualPage);
|
$controller = ModelAsController::controller_for($virtualPage);
|
||||||
$this->assertInstanceOf(VirtualPageTest_ClassAController::class, $controller);
|
$this->assertInstanceOf(VirtualPageTest_ClassAController::class, $controller);
|
||||||
|
Loading…
Reference in New Issue
Block a user