From e2f4dd0b441e04879ad3f0f7054c374a1e639b72 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 24 Apr 2011 11:03:51 +1200 Subject: [PATCH] ENHANCEMENT Added SiteTree::$description to provide more context for content authors selecting a new page type --- code/model/ErrorPage.php | 2 ++ code/model/RedirectorPage.php | 2 ++ code/model/SiteTree.php | 17 +++++++++++++++++ code/model/VirtualPage.php | 2 ++ 4 files changed, 23 insertions(+) diff --git a/code/model/ErrorPage.php b/code/model/ErrorPage.php index f27d248d..753097c5 100755 --- a/code/model/ErrorPage.php +++ b/code/model/ErrorPage.php @@ -24,6 +24,8 @@ class ErrorPage extends Page { static $icon = array("sapphire/javascript/tree/images/page", "file"); + static $description = 'Custom content for different error cases (e.g. "Page not found")'; + protected static $static_filepath = ASSETS_PATH; public function canAddChildren($member = null) { return false; } diff --git a/code/model/RedirectorPage.php b/code/model/RedirectorPage.php index a3972790..c479087c 100755 --- a/code/model/RedirectorPage.php +++ b/code/model/RedirectorPage.php @@ -9,6 +9,8 @@ class RedirectorPage extends Page { static $icon = array("cms/images/treeicons/page-shortcut","file"); + static $description = 'Redirects to a different internal page'; + static $db = array( "RedirectionType" => "Enum('Internal,External','Internal')", "ExternalURL" => "Varchar(2083)" // 2083 is the maximum length of a URL in Internet Explorer. diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index d5334acf..ed626e7f 100755 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -142,6 +142,12 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid * @var string|array */ static $icon = array("sapphire/javascript/tree/images/page", "file"); + + /** + * @var String Description of the class functionality, typically shown to a user + * when selecting which page type to create. Translated through {@link provideI18nEntities()}. + */ + static $description = 'Generic content page'; static $extensions = array( @@ -2590,6 +2596,17 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid if(isset($entities['Page.SINGULARNAME'])) $entities['Page.SINGULARNAME'][3] = 'sapphire'; if(isset($entities['Page.PLURALNAME'])) $entities['Page.PLURALNAME'][3] = 'sapphire'; + $types = self::page_type_classes(); + foreach($types as $type) { + $inst = singleton($type); + $entities[$type . '.DESCRIPTION'] = array( + $inst->stat('description'), + PR_MEDIUM, + 'Description of the page type (shown in the "add page" dialog)' + ); + } + + return $entities; } diff --git a/code/model/VirtualPage.php b/code/model/VirtualPage.php index 2121ca39..4a6f7178 100755 --- a/code/model/VirtualPage.php +++ b/code/model/VirtualPage.php @@ -9,6 +9,8 @@ class VirtualPage extends Page { static $icon = array("cms/images/treeicons/page-shortcut-gold","file"); + static $description = 'Displays the content of another page'; + public static $virtualFields; static $has_one = array(