2011-03-22 22:40:09 +01:00
|
|
|
<?php
|
2016-01-26 06:38:42 +01:00
|
|
|
|
2016-07-22 01:32:32 +02:00
|
|
|
namespace SilverStripe\CMS\Model;
|
|
|
|
|
2016-08-23 04:36:06 +02:00
|
|
|
use SilverStripe\Assets\File;
|
|
|
|
use SilverStripe\ORM\DataExtension;
|
2016-09-13 00:47:02 +02:00
|
|
|
use SilverStripe\View\SSViewer;
|
2016-06-16 06:57:19 +02:00
|
|
|
|
2011-03-22 22:40:09 +01:00
|
|
|
/**
|
2018-04-06 05:53:57 +02:00
|
|
|
* @deprecated 4.2..5.0 Link tracking is baked into File class now
|
2016-01-26 06:38:42 +01:00
|
|
|
* @property File $owner
|
2011-03-22 22:40:09 +01:00
|
|
|
*/
|
2017-01-25 21:59:25 +01:00
|
|
|
class SiteTreeFileExtension extends DataExtension
|
|
|
|
{
|
2018-04-06 05:53:57 +02:00
|
|
|
private static $casting = [
|
2017-01-25 21:59:25 +01:00
|
|
|
'BackLinkHTMLList' => 'HTMLFragment'
|
2018-04-06 05:53:57 +02:00
|
|
|
];
|
2017-01-25 21:59:25 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate an HTML list which provides links to where a file is used.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
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);
|
|
|
|
}
|
2012-03-27 06:05:11 +02:00
|
|
|
}
|