mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #2955 from creative-commoners/pulls/5.2/remove-self
ENH Use class name instead of self
This commit is contained in:
commit
d4ab7f720e
@ -105,7 +105,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
|
||||
private static $tree_class = SiteTree::class;
|
||||
|
||||
private static $session_namespace = self::class;
|
||||
private static $session_namespace = CMSMain::class;
|
||||
|
||||
private static $required_permission_codes = 'CMS_ACCESS_CMSMain';
|
||||
|
||||
@ -587,7 +587,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
|
||||
// Render using full-subtree template
|
||||
return $markingSet->renderChildren(
|
||||
[ self::class . '_SubTree', 'type' => 'Includes' ],
|
||||
[ CMSMain::class . '_SubTree', 'type' => 'Includes' ],
|
||||
$this->getTreeNodeCustomisations()
|
||||
);
|
||||
}
|
||||
@ -607,7 +607,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
'rootTitle' => $rootTitle,
|
||||
'extraClass' => $this->getTreeNodeClasses($node),
|
||||
'Title' => _t(
|
||||
self::class . '.PAGETYPE_TITLE',
|
||||
CMSMain::class . '.PAGETYPE_TITLE',
|
||||
'(Page type: {type}) {title}',
|
||||
[
|
||||
'type' => $node->i18n_singular_name(),
|
||||
@ -718,7 +718,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
|
||||
// Render using single node template
|
||||
$html = $markingSet->renderChildren(
|
||||
[ self::class . '_TreeNode', 'type' => 'Includes'],
|
||||
[ CMSMain::class . '_TreeNode', 'type' => 'Includes'],
|
||||
$this->getTreeNodeCustomisations()
|
||||
);
|
||||
|
||||
|
@ -133,6 +133,6 @@ class ModelAsController extends Controller implements NestedController
|
||||
Debug::message("Using record #$sitetree->ID of type " . get_class($sitetree) . " with link {$sitetree->Link()}");
|
||||
}
|
||||
|
||||
return self::controller_for($sitetree, $this->getRequest()->param('Action'));
|
||||
return ModelAsController::controller_for($sitetree, $this->getRequest()->param('Action'));
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ class OldPageRedirector extends Extension
|
||||
$getvars = $request->getVars();
|
||||
unset($getvars['url']);
|
||||
|
||||
$page = self::find_old_page($params, 0);
|
||||
$page = OldPageRedirector::find_old_page($params, 0);
|
||||
if (!$page) {
|
||||
$page = self::find_old_page($params);
|
||||
$page = OldPageRedirector::find_old_page($params);
|
||||
}
|
||||
$cleanPage = trim(Director::makeRelative($page) ?? '', '/');
|
||||
if (!$cleanPage) {
|
||||
@ -95,7 +95,7 @@ class OldPageRedirector extends Extension
|
||||
if ($page && $page->canView()) {
|
||||
if (count($params ?? [])) {
|
||||
// We have to go deeper!
|
||||
$ret = self::find_old_page($params, $page, $redirect);
|
||||
$ret = OldPageRedirector::find_old_page($params, $page, $redirect);
|
||||
if ($ret) {
|
||||
// A valid child page was found! We can return it
|
||||
return $ret;
|
||||
|
@ -39,12 +39,12 @@ class RootURLController extends Controller implements Resettable
|
||||
*/
|
||||
public static function get_homepage_link()
|
||||
{
|
||||
if (!self::$cached_homepage_link) {
|
||||
if (!RootURLController::$cached_homepage_link) {
|
||||
$link = Config::inst()->get(__CLASS__, 'default_homepage_link');
|
||||
singleton(__CLASS__)->extend('updateHomepageLink', $link);
|
||||
self::$cached_homepage_link = $link;
|
||||
RootURLController::$cached_homepage_link = $link;
|
||||
}
|
||||
return self::$cached_homepage_link;
|
||||
return RootURLController::$cached_homepage_link;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,7 +56,7 @@ class RootURLController extends Controller implements Resettable
|
||||
*/
|
||||
public static function should_be_on_root(SiteTree $page)
|
||||
{
|
||||
return (!self::$is_at_root && self::get_homepage_link() == trim($page->RelativeLink(true) ?? '', '/'));
|
||||
return (!RootURLController::$is_at_root && RootURLController::get_homepage_link() == trim($page->RelativeLink(true) ?? '', '/'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,14 +64,14 @@ class RootURLController extends Controller implements Resettable
|
||||
*/
|
||||
public static function reset()
|
||||
{
|
||||
self::$cached_homepage_link = null;
|
||||
RootURLController::$cached_homepage_link = null;
|
||||
}
|
||||
|
||||
protected function beforeHandleRequest(HTTPRequest $request)
|
||||
{
|
||||
parent::beforeHandleRequest($request);
|
||||
|
||||
self::$is_at_root = true;
|
||||
RootURLController::$is_at_root = true;
|
||||
|
||||
if (!DB::is_active() || !ClassInfo::hasTable('SiteTree')) {
|
||||
$this->getResponse()->redirect(Controller::join_links(
|
||||
@ -86,7 +86,7 @@ class RootURLController extends Controller implements Resettable
|
||||
|
||||
public function handleRequest(HTTPRequest $request): HTTPResponse
|
||||
{
|
||||
self::$is_at_root = true;
|
||||
RootURLController::$is_at_root = true;
|
||||
$this->beforeHandleRequest($request);
|
||||
|
||||
if (!$this->getResponse()->isFinished()) {
|
||||
@ -95,7 +95,7 @@ class RootURLController extends Controller implements Resettable
|
||||
return $this->getResponse();
|
||||
}
|
||||
|
||||
$request->setUrl(self::get_homepage_link() . '/');
|
||||
$request->setUrl(RootURLController::get_homepage_link() . '/');
|
||||
$request->match('$URLSegment//$Action', true);
|
||||
$controller = new ModelAsController();
|
||||
|
||||
|
@ -48,7 +48,7 @@ class LinkablePlugin implements ModelQueryPlugin
|
||||
*/
|
||||
public function getIdentifier(): string
|
||||
{
|
||||
return self::IDENTIFIER;
|
||||
return LinkablePlugin::IDENTIFIER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,11 +128,11 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
* @var array
|
||||
*/
|
||||
private static $allowed_children = [
|
||||
self::class
|
||||
SiteTree::class
|
||||
];
|
||||
|
||||
/**
|
||||
* Used as a cache for `self::allowedChildren()`
|
||||
* Used as a cache for `SiteTree::allowedChildren()`
|
||||
* Drastically reduces admin page load when there are a lot of page types
|
||||
* @var array
|
||||
*/
|
||||
@ -457,7 +457,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
public static function get_by_link($link, $cache = true)
|
||||
{
|
||||
// Compute the column names with dynamic a dynamic table name
|
||||
$tableName = DataObject::singleton(self::class)->baseTable();
|
||||
$tableName = DataObject::singleton(SiteTree::class)->baseTable();
|
||||
$urlSegmentExpr = sprintf('"%s"."URLSegment"', $tableName);
|
||||
$parentIDExpr = sprintf('"%s"."ParentID"', $tableName);
|
||||
|
||||
@ -471,16 +471,16 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
// Grab the initial root level page to traverse down from.
|
||||
$URLSegment = array_shift($parts);
|
||||
$conditions = [$urlSegmentExpr => rawurlencode($URLSegment ?? '')];
|
||||
if (self::config()->get('nested_urls')) {
|
||||
if (static::config()->get('nested_urls')) {
|
||||
$conditions[] = [$parentIDExpr => 0];
|
||||
}
|
||||
/** @var SiteTree $sitetree */
|
||||
$sitetree = DataObject::get_one(self::class, $conditions, $cache);
|
||||
$sitetree = DataObject::get_one(SiteTree::class, $conditions, $cache);
|
||||
|
||||
/// Fall back on a unique URLSegment for b/c.
|
||||
if (!$sitetree
|
||||
&& self::config()->get('nested_urls')
|
||||
&& $sitetree = DataObject::get_one(self::class, [
|
||||
&& static::config()->get('nested_urls')
|
||||
&& $sitetree = DataObject::get_one(SiteTree::class, [
|
||||
$urlSegmentExpr => $URLSegment
|
||||
], $cache)
|
||||
) {
|
||||
@ -489,7 +489,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
|
||||
// Attempt to grab an alternative page from extensions.
|
||||
if (!$sitetree) {
|
||||
$parentID = self::config()->get('nested_urls') ? 0 : null;
|
||||
$parentID = static::config()->get('nested_urls') ? 0 : null;
|
||||
|
||||
if ($alternatives = static::singleton()->extend('alternateGetByLink', $URLSegment, $parentID)) {
|
||||
foreach ($alternatives as $alternative) {
|
||||
@ -505,14 +505,14 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
}
|
||||
|
||||
// Check if we have any more URL parts to parse.
|
||||
if (!self::config()->get('nested_urls') || !count($parts ?? [])) {
|
||||
if (!static::config()->get('nested_urls') || !count($parts ?? [])) {
|
||||
return $sitetree;
|
||||
}
|
||||
|
||||
// Traverse down the remaining URL segments and grab the relevant SiteTree objects.
|
||||
foreach ($parts as $segment) {
|
||||
$next = DataObject::get_one(
|
||||
self::class,
|
||||
SiteTree::class,
|
||||
[
|
||||
$urlSegmentExpr => $segment,
|
||||
$parentIDExpr => $sitetree->ID
|
||||
@ -552,12 +552,12 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
{
|
||||
$classes = ClassInfo::getValidSubClasses();
|
||||
|
||||
$baseClassIndex = array_search(self::class, $classes ?? []);
|
||||
$baseClassIndex = array_search(SiteTree::class, $classes ?? []);
|
||||
if ($baseClassIndex !== false) {
|
||||
unset($classes[$baseClassIndex]);
|
||||
}
|
||||
|
||||
$kill_ancestors = self::config()->get('hide_pagetypes', Config::UNINHERITED) ?? [];
|
||||
$kill_ancestors = SiteTree::config()->get('hide_pagetypes', Config::UNINHERITED) ?? [];
|
||||
|
||||
// figure out if there are any classes we don't want to appear
|
||||
foreach ($classes as $class) {
|
||||
@ -601,8 +601,8 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
}
|
||||
|
||||
/** @var SiteTree $page */
|
||||
if (!($page = DataObject::get_by_id(self::class, $arguments['id'])) // Get the current page by ID.
|
||||
&& !($page = Versioned::get_latest_version(self::class, $arguments['id'])) // Attempt link to old version.
|
||||
if (!($page = DataObject::get_by_id(SiteTree::class, $arguments['id'])) // Get the current page by ID.
|
||||
&& !($page = Versioned::get_latest_version(SiteTree::class, $arguments['id'])) // Attempt link to old version.
|
||||
) {
|
||||
return null; // There were no suitable matches at all.
|
||||
}
|
||||
@ -681,11 +681,11 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
*/
|
||||
public function RelativeLink($action = null)
|
||||
{
|
||||
if ($this->ParentID && self::config()->get('nested_urls')) {
|
||||
if ($this->ParentID && static::config()->get('nested_urls')) {
|
||||
$parent = $this->Parent();
|
||||
// If page is removed select parent from version history (for archive page view)
|
||||
if ((!$parent || !$parent->exists()) && !$this->isOnDraft()) {
|
||||
$parent = Versioned::get_latest_version(self::class, $this->ParentID);
|
||||
$parent = Versioned::get_latest_version(SiteTree::class, $this->ParentID);
|
||||
}
|
||||
$base = $parent ? $parent->RelativeLink($this->URLSegment) : null;
|
||||
} elseif (!$action && $this->URLSegment == RootURLController::get_homepage_link()) {
|
||||
@ -722,7 +722,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
Versioned::set_stage(Versioned::LIVE);
|
||||
$tablename = $this->baseTable();
|
||||
/** @var SiteTree $live */
|
||||
$live = Versioned::get_one_by_stage(self::class, Versioned::LIVE, [
|
||||
$live = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, [
|
||||
"\"$tablename\".\"ID\"" => $this->ID
|
||||
]);
|
||||
if ($live) {
|
||||
@ -996,7 +996,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
{
|
||||
$parentID = $this->getField("ParentID");
|
||||
if ($parentID) {
|
||||
return SiteTree::get_by_id(self::class, $parentID);
|
||||
return SiteTree::get_by_id(SiteTree::class, $parentID);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -1502,11 +1502,11 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
*/
|
||||
private function getGenerator(): string
|
||||
{
|
||||
$generator = trim(Config::inst()->get(self::class, 'meta_generator') ?? '');
|
||||
$generator = trim(Config::inst()->get(SiteTree::class, 'meta_generator') ?? '');
|
||||
if ($generator === '') {
|
||||
return '';
|
||||
}
|
||||
if (self::config()->get('show_meta_generator_version')) {
|
||||
if (static::config()->get('show_meta_generator_version')) {
|
||||
$version = $this->getVersionProvider()->getModuleVersion('silverstripe/framework');
|
||||
// Only include stable version numbers so as not to clutter any aggregate reports
|
||||
// with non-standard versions e.g. forks
|
||||
@ -1594,7 +1594,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
parent::requireDefaultRecords();
|
||||
|
||||
// default pages
|
||||
if (static::class === self::class && $this->config()->get('create_default_pages')) {
|
||||
if (static::class === SiteTree::class && $this->config()->get('create_default_pages')) {
|
||||
$defaultHomepage = RootURLController::config()->get('default_homepage_link');
|
||||
if (!SiteTree::get_by_link($defaultHomepage)) {
|
||||
$homepage = new Page();
|
||||
@ -1863,7 +1863,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
public function validURLSegment()
|
||||
{
|
||||
// Check known urlsegment blacklists
|
||||
if (self::config()->get('nested_urls') && $this->ParentID) {
|
||||
if (static::config()->get('nested_urls') && $this->ParentID) {
|
||||
// Guard against url segments for sub-pages
|
||||
$parent = $this->Parent();
|
||||
if ($controller = ModelAsController::controller_for($parent)) {
|
||||
@ -1893,7 +1893,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
if ($this->ID) {
|
||||
$source = $source->exclude('ID', $this->ID);
|
||||
}
|
||||
if (self::config()->get('nested_urls')) {
|
||||
if (static::config()->get('nested_urls')) {
|
||||
$source = $source->filter('ParentID', $this->ParentID ? $this->ParentID : 0);
|
||||
}
|
||||
return !$source->exists();
|
||||
@ -1935,7 +1935,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
{
|
||||
$tablename = $this->baseTable();
|
||||
/** @var SiteTree $stageRecord */
|
||||
$stageRecord = Versioned::get_one_by_stage(self::class, Versioned::DRAFT, [
|
||||
$stageRecord = Versioned::get_one_by_stage(SiteTree::class, Versioned::DRAFT, [
|
||||
"\"$tablename\".\"ID\"" => $this->ID
|
||||
]);
|
||||
return ($stageRecord) ? $stageRecord->URLSegment : null;
|
||||
@ -1950,7 +1950,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
{
|
||||
$tablename = $this->baseTable();
|
||||
/** @var SiteTree $liveRecord */
|
||||
$liveRecord = Versioned::get_one_by_stage(self::class, Versioned::LIVE, [
|
||||
$liveRecord = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, [
|
||||
"\"$tablename\".\"ID\"" => $this->ID
|
||||
]);
|
||||
return ($liveRecord) ? $liveRecord->URLSegment : null;
|
||||
@ -2124,7 +2124,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
|
||||
$baseLink = Controller::join_links(
|
||||
Director::absoluteBaseURL(),
|
||||
(self::config()->get('nested_urls') && $this->ParentID ? $this->Parent()->RelativeLink(true) : null)
|
||||
(static::config()->get('nested_urls') && $this->ParentID ? $this->Parent()->RelativeLink(true) : null)
|
||||
);
|
||||
|
||||
$urlsegment = SiteTreeURLSegmentField::create("URLSegment", $this->fieldLabel('URLSegment'))
|
||||
@ -2136,7 +2136,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
['pagetype' => $this->i18n_singular_name()]
|
||||
)))
|
||||
->addExtraClass(($this->isHomePage() ? 'homepage-warning' : ''));
|
||||
$helpText = (self::config()->get('nested_urls') && $this->numChildren())
|
||||
$helpText = (static::config()->get('nested_urls') && $this->numChildren())
|
||||
? $this->fieldLabel('LinkChangeNote')
|
||||
: '';
|
||||
if (!URLSegmentFilter::create()->getAllowMultibyte()) {
|
||||
@ -2223,7 +2223,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
), 'Title');
|
||||
}
|
||||
|
||||
if (self::$runCMSFieldsExtensions) {
|
||||
if (SiteTree::$runCMSFieldsExtensions) {
|
||||
$this->extend('updateCMSFields', $fields);
|
||||
}
|
||||
|
||||
@ -2266,7 +2266,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
"root" => _t("SilverStripe\\CMS\\Model\\SiteTree.PARENTTYPE_ROOT", "Top-level page"),
|
||||
"subpage" => _t("SilverStripe\\CMS\\Model\\SiteTree.PARENTTYPE_SUBPAGE", "Sub-page underneath a parent page"),
|
||||
]),
|
||||
$parentIDField = new TreeDropdownField("ParentID", $this->fieldLabel('ParentID'), self::class, 'ID', 'MenuTitle')
|
||||
$parentIDField = new TreeDropdownField("ParentID", $this->fieldLabel('ParentID'), SiteTree::class, 'ID', 'MenuTitle')
|
||||
))->setTitle(_t("SilverStripe\\CMS\\Model\\SiteTree.PAGELOCATION", "Page location")),
|
||||
$visibility = new FieldGroup(
|
||||
new CheckboxField("ShowInMenus", $this->fieldLabel('ShowInMenus')),
|
||||
@ -2397,7 +2397,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
}
|
||||
}
|
||||
|
||||
if (self::$runCMSFieldsExtensions) {
|
||||
if (SiteTree::$runCMSFieldsExtensions) {
|
||||
$this->extend('updateSettingsFields', $fields);
|
||||
}
|
||||
|
||||
@ -2411,7 +2411,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
public function fieldLabels($includerelations = true)
|
||||
{
|
||||
$cacheKey = static::class . '_' . $includerelations;
|
||||
if (!isset(self::$_cache_field_labels[$cacheKey])) {
|
||||
if (!isset(SiteTree::$_cache_field_labels[$cacheKey])) {
|
||||
$labels = parent::fieldLabels($includerelations);
|
||||
$labels['Title'] = _t(__CLASS__.'.PAGETITLE', "Page name");
|
||||
$labels['MenuTitle'] = _t(__CLASS__.'.MENUTITLE', "Navigation label");
|
||||
@ -2442,10 +2442,10 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
$labels['BackLinkTracking'] = _t(__CLASS__.'.many_many_BackLinkTracking', 'Backlink Tracking');
|
||||
}
|
||||
|
||||
self::$_cache_field_labels[$cacheKey] = $labels;
|
||||
SiteTree::$_cache_field_labels[$cacheKey] = $labels;
|
||||
}
|
||||
|
||||
return self::$_cache_field_labels[$cacheKey];
|
||||
return SiteTree::$_cache_field_labels[$cacheKey];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2487,8 +2487,8 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
$rootTabSet->addExtraClass('ss-ui-action-tabset action-menus noborder');
|
||||
|
||||
// Render page information into the "more-options" drop-up, on the top.
|
||||
$liveRecord = Versioned::get_by_stage(self::class, Versioned::LIVE)->byID($this->ID);
|
||||
$infoTemplate = SSViewer::get_templates_by_class(static::class, '_Information', self::class);
|
||||
$liveRecord = Versioned::get_by_stage(SiteTree::class, Versioned::LIVE)->byID($this->ID);
|
||||
$infoTemplate = SSViewer::get_templates_by_class(static::class, '_Information', SiteTree::class);
|
||||
$moreOptions->push(
|
||||
new LiteralField(
|
||||
'Information',
|
||||
@ -2642,7 +2642,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
{
|
||||
// Use an alias to get the updates made by $this->publish
|
||||
/** @var SiteTree $stageSelf */
|
||||
$stageSelf = Versioned::get_by_stage(self::class, Versioned::DRAFT)->byID($this->ID);
|
||||
$stageSelf = Versioned::get_by_stage(SiteTree::class, Versioned::DRAFT)->byID($this->ID);
|
||||
$stageSelf->writeWithoutVersion();
|
||||
|
||||
// Need to update pages linking to this one as no longer broken
|
||||
@ -2663,7 +2663,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
{
|
||||
if ($parentID = $this->ParentID) {
|
||||
/** @var SiteTree $parentPage */
|
||||
$parentPage = Versioned::get_latest_version(self::class, $parentID);
|
||||
$parentPage = Versioned::get_latest_version(SiteTree::class, $parentID);
|
||||
if (!$parentPage || !$parentPage->isOnDraft()) {
|
||||
return true;
|
||||
}
|
||||
@ -2690,7 +2690,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
|
||||
// Need to update pages linking to this one as no longer broken
|
||||
/** @var SiteTree $result */
|
||||
$result = Versioned::get_by_stage(self::class, Versioned::DRAFT)
|
||||
$result = Versioned::get_by_stage(SiteTree::class, Versioned::DRAFT)
|
||||
->byID($this->ID);
|
||||
$result->updateDependentPages();
|
||||
|
||||
@ -2730,7 +2730,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
*/
|
||||
protected function getClassDropdown()
|
||||
{
|
||||
$classes = self::page_type_classes();
|
||||
$classes = SiteTree::page_type_classes();
|
||||
$currentClass = null;
|
||||
|
||||
$result = [];
|
||||
@ -3129,7 +3129,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
*/
|
||||
public static function disableCMSFieldsExtensions()
|
||||
{
|
||||
self::$runCMSFieldsExtensions = false;
|
||||
SiteTree::$runCMSFieldsExtensions = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3138,7 +3138,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
*/
|
||||
public static function enableCMSFieldsExtensions()
|
||||
{
|
||||
self::$runCMSFieldsExtensions = true;
|
||||
SiteTree::$runCMSFieldsExtensions = true;
|
||||
}
|
||||
|
||||
public function providePermissions()
|
||||
@ -3184,7 +3184,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
*/
|
||||
public function singular_name()
|
||||
{
|
||||
$base = in_array(static::class, [Page::class, self::class]);
|
||||
$base = in_array(static::class, [Page::class, SiteTree::class]);
|
||||
if ($base) {
|
||||
return $this->config()->get('base_singular_name');
|
||||
}
|
||||
@ -3198,7 +3198,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
*/
|
||||
public function plural_name()
|
||||
{
|
||||
$base = in_array(static::class, [Page::class, self::class]);
|
||||
$base = in_array(static::class, [Page::class, SiteTree::class]);
|
||||
if ($base) {
|
||||
return $this->config()->get('base_plural_name');
|
||||
}
|
||||
@ -3242,7 +3242,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
*/
|
||||
public function classDescription()
|
||||
{
|
||||
$base = in_array(static::class, [Page::class, self::class]);
|
||||
$base = in_array(static::class, [Page::class, SiteTree::class]);
|
||||
if ($base) {
|
||||
return $this->config()->get('base_description');
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class VirtualPage extends Page
|
||||
|
||||
/**
|
||||
* @var array Define fields that are not virtual - the virtual page must define these fields themselves.
|
||||
* Note that anything in {@link self::config()->initially_copied_fields} is implicitly included in this list.
|
||||
* Note that anything in {@link static::config()->initially_copied_fields} is implicitly included in this list.
|
||||
*/
|
||||
private static $non_virtual_fields = [
|
||||
"ID",
|
||||
@ -107,7 +107,7 @@ class VirtualPage extends Page
|
||||
*/
|
||||
public function getNonVirtualisedFields()
|
||||
{
|
||||
$config = self::config();
|
||||
$config = static::config();
|
||||
return array_merge(
|
||||
$config->get('non_virtual_fields'),
|
||||
$config->get('initially_copied_fields')
|
||||
@ -219,7 +219,7 @@ class VirtualPage extends Page
|
||||
// Setup the linking to the original page.
|
||||
$copyContentFromField = TreeDropdownField::create(
|
||||
'CopyContentFromID',
|
||||
_t(self::class . '.CHOOSE', "Linked Page"),
|
||||
_t(VirtualPage::class . '.CHOOSE', "Linked Page"),
|
||||
SiteTree::class
|
||||
);
|
||||
|
||||
@ -248,10 +248,10 @@ class VirtualPage extends Page
|
||||
'class' => 'cmsEditlink',
|
||||
'href' => $this->CopyContentFrom()->CMSEditLink(),
|
||||
],
|
||||
_t(self::class . '.EditLink', 'edit')
|
||||
_t(VirtualPage::class . '.EditLink', 'edit')
|
||||
);
|
||||
$msgs[] = _t(
|
||||
self::class . '.HEADERWITHLINK',
|
||||
VirtualPage::class . '.HEADERWITHLINK',
|
||||
"This is a virtual page copying content from \"{title}\" ({link})",
|
||||
[
|
||||
'title' => $this->CopyContentFrom()->obj('Title'),
|
||||
@ -259,7 +259,7 @@ class VirtualPage extends Page
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$msgs[] = _t(self::class . '.HEADER', "This is a virtual page");
|
||||
$msgs[] = _t(VirtualPage::class . '.HEADER', "This is a virtual page");
|
||||
$msgs[] = _t(
|
||||
'SilverStripe\\CMS\\Model\\SiteTree.VIRTUALPAGEWARNING',
|
||||
'Please choose a linked page and save first in order to publish this page'
|
||||
@ -305,7 +305,7 @@ class VirtualPage extends Page
|
||||
// We also want to copy certain, but only if we're copying the source page for the first
|
||||
// time. After this point, the user is free to customise these for the virtual page themselves.
|
||||
if ($this->isChanged('CopyContentFromID', 2) && $this->CopyContentFromID) {
|
||||
foreach (self::config()->get('initially_copied_fields') as $fieldName) {
|
||||
foreach (static::config()->get('initially_copied_fields') as $fieldName) {
|
||||
$this->$fieldName = $source->$fieldName;
|
||||
}
|
||||
}
|
||||
@ -347,7 +347,7 @@ class VirtualPage extends Page
|
||||
if ($orig && $orig->exists() && !$orig->config()->get('can_be_root') && !$this->ParentID) {
|
||||
$result->addError(
|
||||
_t(
|
||||
self::class . '.PageTypNotAllowedOnRoot',
|
||||
VirtualPage::class . '.PageTypNotAllowedOnRoot',
|
||||
'Original page type "{type}" is not allowed on the root level for this virtual page',
|
||||
['type' => $orig->i18n_singular_name()]
|
||||
),
|
||||
|
@ -16,7 +16,7 @@ class CMSMainTest_ClassA extends SiteTree implements TestOnly
|
||||
{
|
||||
parent::onBeforeWrite();
|
||||
|
||||
if ($this->ClassName !== self::class) {
|
||||
if ($this->ClassName !== CMSMainTest_ClassA::class) {
|
||||
throw new ValidationException("Class saved with incorrect ClassName");
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ class CMSMainTest_ClassB extends SiteTree implements TestOnly
|
||||
{
|
||||
parent::onBeforeWrite();
|
||||
|
||||
if ($this->ClassName !== self::class) {
|
||||
if ($this->ClassName !== CMSMainTest_ClassB::class) {
|
||||
throw new ValidationException("Class saved with incorrect ClassName");
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ class CmsReportsTest extends SapphireTest
|
||||
parent::setUp();
|
||||
|
||||
// set the dates by hand: impossible to set via yml
|
||||
$afterThreshold = strtotime('-' . (self::$daysAgo - 1) . ' days', strtotime('31-06-2009 00:00:00'));
|
||||
$beforeThreshold = strtotime('-' . (self::$daysAgo + 1) . ' days', strtotime('31-06-2009 00:00:00'));
|
||||
$afterThreshold = strtotime('-' . (CmsReportsTest::$daysAgo - 1) . ' days', strtotime('31-06-2009 00:00:00'));
|
||||
$beforeThreshold = strtotime('-' . (CmsReportsTest::$daysAgo + 1) . ' days', strtotime('31-06-2009 00:00:00'));
|
||||
|
||||
$after = $this->objFromFixture(SiteTree::class, 'after');
|
||||
$before = $this->objFromFixture(SiteTree::class, 'before');
|
||||
|
Loading…
Reference in New Issue
Block a user