Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save michalkleiner/9c89ff4aebdd024499b586f62ad435b6 to your computer and use it in GitHub Desktop.
Save michalkleiner/9c89ff4aebdd024499b586f62ad435b6 to your computer and use it in GitHub Desktop.
Remove File tracking and Link tracking tabs in SS 4.2
---
Name: cwp-fix
After: cmslinktracking
---
SilverStripe\ORM\DataObject:
extensions:
- Chrometoaster\Extensions\DataObject\HideFileAndLinkTrackingTabsExtension
<?php
// Files to create:
// app/src/Extensions/DataObject/HideFileAndLinkTrackingTabsExtension.php
// app/_config/cwp_fix.yml
namespace Chrometoaster\Extensions\DataObject;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\DataExtension;
class HideFileAndLinkTrackingTabsExtension extends DataExtension
{
/**
* Temporarily hide all link and file tracking tabs/fields in the CMS UI
* added in SS 4.2 until 4.3 is available
*
* Related GitHub issues and PRs:
* - https://github.com/silverstripe/silverstripe-cms/issues/2227
* - https://github.com/silverstripe/silverstripe-cms/issues/2251
* - https://github.com/silverstripe/silverstripe-assets/pull/163
*
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
{
$fields->removeByName(['FileTracking', 'LinkTracking']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment