diff --git a/src/VersionFeed.php b/src/VersionFeed.php index ad7e1bc..da6d8d5 100644 --- a/src/VersionFeed.php +++ b/src/VersionFeed.php @@ -13,10 +13,13 @@ use SilverStripe\SiteConfig\SiteConfig; use SilverStripe\View\Parsers\HtmlDiff; use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Versioned\Versioned_Version; +/** + * @extends Extension<SiteTree&static> + */ class VersionFeed extends SiteTreeExtension { - private static $db = array( 'PublicHistory' => 'Boolean(true)' ); @@ -68,7 +71,7 @@ public function updateFieldLabels(&$labels) * @param int $highestVersion Top version number to consider. * @param int $limit Limit to the amount of items returned. * - * @returns ArrayList List of cleaned records. + * @return ArrayList<Versioned_Version> List of cleaned records. */ public function getDiffList($highestVersion = null, $limit = 100) { @@ -156,7 +159,7 @@ public function getDiffList($highestVersion = null, $limit = 100) * Return a single diff representing this version. * Returns the initial version if there is nothing to compare to. * - * @return DataObject|null Object with relevant fields diffed. + * @return Versioned_Version|null Object with relevant fields diffed. */ public function getDiff() { @@ -173,7 +176,7 @@ public function updateSettingsFields(FieldList $fields) if (!$this->owner->config()->get('changes_enabled')) { return; } - + // Add public history field. $fields->addFieldToTab( 'Root.Settings', diff --git a/src/VersionFeedController.php b/src/VersionFeedController.php index 05072b0..3527389 100644 --- a/src/VersionFeedController.php +++ b/src/VersionFeedController.php @@ -11,25 +11,29 @@ use SilverStripe\Security\Member; use SilverStripe\ORM\ArrayList; use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Control\Controller; use SilverStripe\Core\Convert; use SilverStripe\View\Requirements; use SilverStripe\Core\Extension; use SilverStripe\VersionFeed\Filters\ContentFilter; +/** + * @extends Extension<Controller&static> + */ class VersionFeedController extends Extension { private static $allowed_actions = array( 'changes', 'allchanges' ); - + /** * Content handler * * @var ContentFilter */ protected $contentFilter; - + /** * Sets the content filter * @@ -39,7 +43,7 @@ public function setContentFilter(ContentFilter $contentFilter) { $this->contentFilter = $contentFilter; } - + /** * Evaluates the result of the given callback * @@ -163,7 +167,7 @@ public function allchanges() $rss->setTemplate('Page_allchanges_rss'); return $rss->outputToBrowser(); } - + /** * Generates and embeds the RSS header link for the page-specific version rss feed */ @@ -172,7 +176,7 @@ public function linkToPageRSSFeed() if (!Config::inst()->get(VersionFeed::class, 'changes_enabled') || !$this->owner->PublicHistory) { return; } - + RSSFeed::linkToFeed( $this->owner->Link('changes'), _t( @@ -193,7 +197,7 @@ public function linkToAllSiteRSSFeed() ) { return; } - + // RSS feed to all-site changes. $title = Convert::raw2xml($this->linkToAllSitesRSSFeedTitle()); $url = $this->owner->getSiteRSSLink(); diff --git a/src/VersionFeedSiteConfig.php b/src/VersionFeedSiteConfig.php index 099ff85..74a1624 100644 --- a/src/VersionFeedSiteConfig.php +++ b/src/VersionFeedSiteConfig.php @@ -7,13 +7,15 @@ use SilverStripe\Forms\FieldGroup; use SilverStripe\Forms\FieldList; use SilverStripe\ORM\DataExtension; +use SilverStripe\SiteConfig\SiteConfig; /** * Allows global configuration of all changes + * + * @extends DataExtension<SiteConfig> */ class VersionFeedSiteConfig extends DataExtension { - private static $db = array( 'AllChangesEnabled' => 'Boolean(true)' ); @@ -26,7 +28,7 @@ public function updateFieldLabels(&$labels) { $labels['AllChangesEnabled'] = _t(__CLASS__ . '.ALLCHANGESLABEL', 'Make global changes feed public'); } - + public function updateCMSFields(FieldList $fields) { if (!Config::inst()->get(VersionFeed::class, 'allchanges_enabled')) {