33namespace NSWDPC \Elemental \Extensions \Curator ;
44
55use NSWDPC \Elemental \Models \Curator \CuratorFeed ;
6- use Silverstripe \ORM \DataExtension ;
7- use Silverstripe \Forms \FieldList ;
8- use Silverstripe \Forms \DropdownField ;
6+ use SilverStripe \ORM \DataExtension ;
7+ use SilverStripe \Forms \FieldList ;
8+ use SilverStripe \Forms \DropdownField ;
99
1010/**
1111 * Provide content administrators the ability to select a global site social feed
1212 * from a list of configured feeds
1313 * @author James
14+ * @property int $CuratorFeedRecordID
15+ * @method \NSWDPC\Elemental\Models\Curator\CuratorFeed CuratorFeedRecord()
16+ * @extends \SilverStripe\ORM\DataExtension<(\SilverStripe\SiteConfig\SiteConfig & static)>
1417 */
1518class SiteConfigExtension extends DataExtension
1619{
17-
1820 /**
1921 * @inheritdoc
2022 */
21- private static $ has_one = [
23+ private static array $ has_one = [
2224 'CuratorFeedRecord ' => CuratorFeed::class
2325 ];
2426
@@ -32,7 +34,7 @@ public function updateCmsFields(FieldList $fields)
3234 [
3335 DropdownField::create (
3436 'CuratorFeedRecordID ' ,
35- _t (__CLASS__ . '.SELECT_CURATOR_FEED ' , 'Select a global Curator.io feed ' ),
37+ _t (self ::class . '.SELECT_CURATOR_FEED ' , 'Select a global Curator.io feed ' ),
3638 CuratorFeed::get ()->map ('ID ' , 'Title ' )
3739 )->setEmptyString ('' )
3840 ]
@@ -42,22 +44,22 @@ public function updateCmsFields(FieldList $fields)
4244 /**
4345 * To add the field to your own SiteConfig extension, call this method
4446 * e.g $this->owner->getSocialFeedSelector()
45- * @return DropdownField
4647 */
47- public function getSocialFeedSelector () : DropdownField {
48- $ field = DropdownField::create (
48+ public function getSocialFeedSelector (): DropdownField
49+ {
50+ return DropdownField::create (
4951 'CuratorFeedRecordID ' ,
50- _t (__CLASS__ . '.SELECT_CURATOR_FEED ' , 'Select a global Curator.io feed ' ),
52+ _t (self ::class . '.SELECT_CURATOR_FEED ' , 'Select a global Curator.io feed ' ),
5153 CuratorFeed::get ()->map ('ID ' , 'Title ' )
5254 )->setEmptyString ('' );
53- return $ field ;
5455 }
5556
5657 /**
5758 * @return CuratorFeed|null
5859 */
59- public function getSocialFeedRecord () {
60- return $ this ->owner ->CuratorFeedRecord ();
60+ public function getSocialFeedRecord ()
61+ {
62+ return $ this ->getOwner ()->CuratorFeedRecord ();
6163 }
6264
6365}
0 commit comments