protected function TwitterProfile::getConnection in Twitter Profile Widget 8.2
Same name and namespace in other branches
- 8 src/TwitterProfile.php \Drupal\twitter_profile_widget\TwitterProfile::getConnection()
Internal method for retrieving & building the settings configuration.
Parameters
string $key: Twitter API key.
string $secret: Twitter API secret.
Return value
str[] An array of settings compatible with TwitterAPIExchange class.
2 calls to TwitterProfile::getConnection()
- TwitterProfile::checkConnection in src/
TwitterProfile.php - Helper query to check whether the credentials are valid.
- TwitterProfile::pull in src/
TwitterProfile.php - Pull tweets from the Twitter API.
File
- src/
TwitterProfile.php, line 71
Class
- TwitterProfile
- Class TwitterProfile.
Namespace
Drupal\twitter_profile_widgetCode
protected function getConnection($key = '', $secret = '') {
if (empty($key) || empty($secret)) {
$config = \Drupal::config('twitter_profile_widget.settings');
$key = $config
->get('twitter_widget_key');
$secret = $config
->get('twitter_widget_secret');
if (empty($key) || empty($secret)) {
return FALSE;
}
}
// Currently, we don't use OAuth.
return [
'oauth_access_token' => '',
'oauth_access_token_secret' => '',
'consumer_key' => $key,
'consumer_secret' => $secret,
];
}