silverstripe-cms/code/Model/SiteTreeFileExtension.php

36 lines
848 B
PHP
Raw Normal View History

<?php
2016-07-22 11:32:32 +12:00
namespace SilverStripe\CMS\Model;
2022-10-18 15:23:59 +13:00
use SilverStripe\Dev\Deprecation;
use SilverStripe\Assets\File;
use SilverStripe\ORM\DataExtension;
2016-09-13 10:47:02 +12:00
use SilverStripe\View\SSViewer;
/**
2022-10-18 15:23:59 +13:00
* @deprecated 4.2.0 Use FileLinkTracking instead
* @property File $owner
*/
2017-01-26 09:59:25 +13:00
class SiteTreeFileExtension extends DataExtension
{
private static $casting = [
2017-01-26 09:59:25 +13:00
'BackLinkHTMLList' => 'HTMLFragment'
];
2017-01-26 09:59:25 +13:00
/**
* Generate an HTML list which provides links to where a file is used.
*
* @return string
*/
2022-10-18 15:23:59 +13:00
public function __construct()
{
Deprecation::notice('4.2.0', 'Use FileLinkTracking instead', Deprecation::SCOPE_CLASS);
}
2017-01-26 09:59:25 +13:00
public function BackLinkHTMLList()
{
2022-01-17 12:29:25 +13:00
$viewer = SSViewer::create(['type' => 'Includes', self::class . '_description']);
2017-01-26 09:59:25 +13:00
return $viewer->process($this->owner);
}
}