コード例 #1
0
 public function getCMSFields()
 {
     $this->beforeExtending('updateCMSFields', function (FieldList $fields) {
         $fields->removeByName('PageID');
         $fields->replaceField('Username', TreeDropdownField::create('PageID', _t('SocialFeed.DISPLAY_CHILDREN_OF_PAGE', 'Display children of'), 'Page'));
     });
     return parent::getCMSFields();
 }
コード例 #2
0
 public function getCMSFields()
 {
     $this->beforeExtending('updateCMSFields', function ($fields) {
         $fields->removeByName('ChannelId');
         $fields->insertBefore(\TextField::create('ChannelId', $this->fieldLabel('ChannelId'))->setDescription(_t('SocialFeed.DESC-CHANNEL_ID', 'If left empty, will use the channel of the username below')), 'Username');
     });
     return parent::getCMSFields();
 }
コード例 #3
0
 public function getCMSFields()
 {
     $this->beforeExtending('updateCMSFields', function ($fields) {
         if ($type = $fields->dataFieldByName('Type')) {
             $type->setSource(['user_timeline' => _t('SocialFeed_Twitter.USER_TIMELINE', 'User Tweets'), 'mentions_timeline' => _t('SocialFeed_Twitter.MENTIONS_TIMELINE', 'User Mentions'), 'home_timeline' => _t('SocialFeed_Twitter.HOME_TIMELINE', 'Home Timeline')]);
         }
     });
     return parent::getCMSFields();
 }
コード例 #4
0
 public function getCMSFields()
 {
     $this->beforeExtending('updateCMSFields', function ($fields) {
         if ($type = $fields->dataFieldByName('Type')) {
             $types = ['feed' => _t('SocialFeed_Facebook.FEED', 'News feed (inc. statuses/posts, milestones and links)'), 'albums' => _t('SocialFeed_Facebook.ALBUMS', 'Albums'), 'events' => _t('SocialFeed_Facebook.EVENTS', 'Events'), 'links' => _t('SocialFeed_Facebook.LINKS', 'Posted links'), 'milestones' => _t('SocialFeed_Facebook.MILESTONES', 'Milestones'), 'photos' => _t('SocialFeed_Facebook.PHOTOS_TAGGED_IN', 'Photos where I have been tagged'), 'photos/uploaded' => _t('SocialFeed_Facebook.UPLOADED_PHOTOS', 'Uploaded photos'), 'videos' => _t('SocialFeed_Facebook.VIDEOS_TAGGED_IN', 'Videos where I have been tagged'), 'videos/uploaded' => _t('SocialFeed_Facebook.VIDEOS_UPLOADED_PHOTOS', 'Uploaded videos')];
             if (class_exists('League\\OAuth2\\Client\\Token\\AccessToken')) {
                 $types['ratings'] = _t('SocialFeed_Facebook.RATINGS', 'Reviews received (requires Facebook login permissions)');
                 $types['offers'] = _t('SocialFeed_Facebook.OFFERS', 'Offers (requires Facebook login permissions)');
             }
             $type->setSource($types);
         }
     });
     return parent::getCMSFields();
 }
コード例 #5
0
 public function getCMSFields()
 {
     $this->beforeExtending('updateCMSFields', function ($fields) {
         $fields->removeByName('LocationName');
         $fields->removeByName('LocationAddress');
         if (\ClassInfo::exists('Select2Field')) {
             $fields->replaceField('Username', $location = \Select2Field::create('LocationAndUsername', _t('GooglePlaces.LOCATION', 'Location'), '', function ($query = '', $limit = 10) {
                 return $query ? \Object::create($this->Provider, 0, (array) $this->OauthConfiguration)->textSearch($query, ['query' => ['key' => $this->setting('ApiKey')]]) : [];
             }, null, 'name||formatted_address', 'place_id||name||formatted_address')->setPrefetch(false)->requireSelection(true)->setMinimumSearchLength(15));
             if ($this->LocationAddress) {
                 $location->setEmptyString($this->LocationName . ' - ' . $this->LocationAddress);
             }
         } else {
             if ($username = $fields->dataFieldByName('Username')) {
                 $username->setTitle(_t('SocialFeed.PLACE_ID', 'Place ID'));
                 $username->setDescription(_t('SocialFeed.DESC-PLACE_ID', '<a href="{url}" target="_blank">You can find the place ID of your location here.</a>', ['url' => 'https://developers.google.com/places/documentation/place-id#find-id']));
             }
         }
     });
     return parent::getCMSFields();
 }