diff --git a/_config/asset-admin.yml b/_config/asset-admin.yml deleted file mode 100644 index f5c57ced..00000000 --- a/_config/asset-admin.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -Name: cms-asset-admin -OnlyIf: - ModuleExists: silverstripe/asset-admin ---- -SilverStripe\AssetAdmin\Forms\FileFormFactory: - extensions: - - SilverStripe\CMS\Model\SiteTreeFileFormFactoryExtension diff --git a/code/Model/SiteTreeFileFormFactoryExtension.php b/code/Model/SiteTreeFileFormFactoryExtension.php index c3d6583a..d420b86d 100644 --- a/code/Model/SiteTreeFileFormFactoryExtension.php +++ b/code/Model/SiteTreeFileFormFactoryExtension.php @@ -3,14 +3,18 @@ namespace SilverStripe\CMS\Model; use SilverStripe\Assets\File; +use SilverStripe\Dev\Deprecation; use SilverStripe\Forms\FieldList; -use SilverStripe\Forms\ReadonlyField; use SilverStripe\Forms\Tab; use SilverStripe\Forms\TabSet; use SilverStripe\ORM\DataExtension; -use SilverStripe\ORM\FieldType\DBHTMLText; +use SilverStripe\Admin\Forms\UsedOnTable; +use SilverStripe\Versioned\RecursivePublishable; /** + * @deprecated 5.0 + * No longer required - superceded by {@see UsedOnTable} + * * Extension applied to {@see FileFormFactory} to decorate with a "Used on:" information area. * Uses tracking provided by {@see SiteTreeFileExtension} to generate this. * @@ -20,30 +24,22 @@ class SiteTreeFileFormFactoryExtension extends DataExtension { public function updateFormFields(FieldList $fields, $controller, $formName, $context) { - // Create field - /** @var File|SiteTreeFileExtension $record */ - $record = $context['Record']; - $usedOnField = ReadonlyField::create( - 'BackLinkCount', - _t(__CLASS__.'.BACKLINKCOUNT', 'Used on:'), - $record->BackLinkTrackingCount() . ' ' . _t(__CLASS__.'.PAGES', 'page(s)') - ) - ->addExtraClass('cms-description-toggle'); - - // Add table - /** @var DBHTMLText $backlinkHTML */ - $backlinkHTML = $record->BackLinkHTMLList(); - if (trim($backlinkHTML->forTemplate())) { - $usedOnField->setDescription($backlinkHTML); - } - /** @var TabSet $tabset */ $tabset = $fields->fieldByName('Editor'); - if ($tabset) { - // Add field to new tab - /** @var Tab $tab */ - $tab = Tab::create('Usage', _t(__CLASS__.'.USAGE', 'Usage'), $usedOnField); - $tabset->push($tab); + if (!$tabset) { + return; } + $class = UsedOnTable::class; + Deprecation::notice('5.0', "Use the $class to show this table"); + + /** @var File|SiteTreeFileExtension|RecursivePublishable $record */ + $record = $context['Record']; + + $usedOnField = UsedOnTable::create('UsedOnTableReplacement'); + + // Add field to new tab + /** @var Tab $tab */ + $tab = Tab::create('Usage', _t(__CLASS__ . '.USAGE', 'Usage'), $usedOnField); + $tabset->push($tab); } }