silverstripe-cms/code/Model/SiteTreeFileExtension.php

36 lines
848 B
PHP
Raw Normal View History

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