class FacebookPostCollectorFactory in Social Feed 8
Class FacebookPostCollectorFactory.
@package Drupal\socialfeed
Hierarchy
- class \Drupal\socialfeed\Services\FacebookPostCollectorFactory
Expanded class hierarchy of FacebookPostCollectorFactory
1 file declares its use of FacebookPostCollectorFactory
- FacebookPostBlock.php in src/
Plugin/ Block/ FacebookPostBlock.php
1 string reference to 'FacebookPostCollectorFactory'
1 service uses FacebookPostCollectorFactory
File
- src/
Services/ FacebookPostCollectorFactory.php, line 12
Namespace
Drupal\socialfeed\ServicesView source
class FacebookPostCollectorFactory {
/**
* Default Facebook application id.
*
* @var string
*/
protected $defaultAppId;
/**
* Default Facebook application secret.
*
* @var string
*/
protected $defaultAppSecret;
/**
* Page name.
*
* @var string
*/
protected $pageName;
/**
* FacebookPostCollector constructor.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
* Config factory.
*/
public function __construct(ConfigFactoryInterface $configFactory) {
$config = $configFactory
->get('socialfeed.facebooksettings');
$this->defaultAppId = $config
->get('app_id');
$this->defaultAppSecret = $config
->get('secret_key');
$this->defaultUserToken = $config
->get('user_token');
$this->pageName = $config
->get('page_name');
}
/**
* Creates a pre-configured instance.
*
* @param string $appId
* The facebook application id.
* @param string $appSecret
* The facebook application secret.
* @param string $userToken
* The facebook user token.
* @param string $pageName
* The facebook page name.
*
* @return \Drupal\socialfeed\Services\FacebookPostCollector
* A fully configured instance from FacebookPostCollector.
*
* @throws \Exception
* If the instance cannot be created, such as if the ID is invalid.
*/
public function createInstance(string $appId, string $appSecret, string $userToken, string $pageName) {
return new FacebookPostCollector($appId ?: $this->defaultAppId, $appSecret ?: $this->defaultAppSecret, $userToken ?: $this->defaultUserToken, $pageName ?: ($this->pageName = $pageName));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FacebookPostCollectorFactory:: |
protected | property | Default Facebook application id. | |
FacebookPostCollectorFactory:: |
protected | property | Default Facebook application secret. | |
FacebookPostCollectorFactory:: |
protected | property | Page name. | |
FacebookPostCollectorFactory:: |
public | function | Creates a pre-configured instance. | |
FacebookPostCollectorFactory:: |
public | function | FacebookPostCollector constructor. |