diff --git a/code/Model/SiteTreeFileExtension.php b/code/Model/SiteTreeFileExtension.php index 2fd0f41a..2996612e 100644 --- a/code/Model/SiteTreeFileExtension.php +++ b/code/Model/SiteTreeFileExtension.php @@ -10,6 +10,7 @@ use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\ManyManyList; use SilverStripe\ORM\Versioning\Versioned; +use SilverStripe\View\SSViewer; use Subsite; /** @@ -38,6 +39,10 @@ class SiteTreeFileExtension extends DataExtension { 'BackLinkTracking' ); + private static $casting = array( + 'BackLinkHTMLList' => 'HTMLFragment' + ); + public function updateCMSFields(FieldList $fields) { $fields->insertAfter( 'LastEdited', @@ -57,25 +62,9 @@ class SiteTreeFileExtension extends DataExtension { * @return string */ public function BackLinkHTMLList() { - $html = '' . _t( - 'SiteTreeFileExtension.BACKLINK_LIST_DESCRIPTION', - 'This list shows all pages where the file has been added through a WYSIWYG editor.' - ) . ''; + $viewer = new SSViewer(["type" => "Includes", __CLASS__ . "_description"]); - $html .= ''; - - return $html; + return $viewer->process($this->owner); } /** diff --git a/lang/en.yml b/lang/en.yml index 0b44e1b7..b0057ee6 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -421,6 +421,9 @@ en: many_many_ImageTracking: 'Image Tracking' many_many_LinkTracking: 'Link Tracking' SiteTreeFileExtension: + TITLE_INDEX: '#' + TITLE_USED_ON: 'Used On' + TITLE_TYPE: 'Type' BACKLINK_LIST_DESCRIPTION: 'This list shows all pages where the file has been added through a WYSIWYG editor.' EDIT: Edit SiteTreeURLSegmentField: diff --git a/templates/SilverStripe/CMS/Model/Includes/SiteTreeFileExtension_description.ss b/templates/SilverStripe/CMS/Model/Includes/SiteTreeFileExtension_description.ss new file mode 100644 index 00000000..0a3c993c --- /dev/null +++ b/templates/SilverStripe/CMS/Model/Includes/SiteTreeFileExtension_description.ss @@ -0,0 +1,27 @@ +<% if $BackLinkTracking %> + + + + + + + + + + <% loop $BackLinkTracking %> + + + + + + <% end_loop %> + +
<% _t('SiteTreeFileExtension.TITLE_INDEX', '#') %><% _t('SiteTreeFileExtension.TITLE_USED_ON', 'Used on') %><% _t('SiteTreeFileExtension.TITLE_TYPE', 'Type') %>
$Pos$MenuTitle + $i18n_singular_name + <% if $isPublished %> + Published + <% else %> + Draft + <% end_if %> +
+<% end_if %>