public function BynderApi::getAssetBankManager in Bynder 8
Same name and namespace in other branches
- 8.3 src/BynderApi.php \Drupal\bynder\BynderApi::getAssetBankManager()
- 8.2 src/BynderApi.php \Drupal\bynder\BynderApi::getAssetBankManager()
- 4.0.x src/BynderApi.php \Drupal\bynder\BynderApi::getAssetBankManager()
Gets an instance of the asset bank manager to use for DAM queries.
Return value
\Bynder\Api\IAssetBankManager An instance of the asset bank manager using the request handler.
Overrides BynderApiInterface::getAssetBankManager
1 call to BynderApi::getAssetBankManager()
- BynderApi::hasUploadPermissions in src/
BynderApi.php - Checks if the current user has upload permissions.
File
- src/
BynderApi.php, line 265
Class
- BynderApi
- Bynder API service.
Namespace
Drupal\bynderCode
public function getAssetBankManager() {
$bynder_settings = $this->configFactory
->get('bynder.settings');
if ($this->bynderConfig) {
$bynder_configuration = [
'consumerKey' => $this->bynderConfig['consumerKey'],
'consumerSecret' => $this->bynderConfig['consumerSecret'],
'token' => $this->bynderConfig['token'],
'tokenSecret' => $this->bynderConfig['tokenSecret'],
'baseUrl' => $this->bynderConfig['baseUrl'],
'requestOptions' => [
'timeout' => $bynder_settings
->get('timeout'),
],
];
}
else {
$bynder_configuration = [
'consumerKey' => $bynder_settings
->get('consumer_key'),
'consumerSecret' => $bynder_settings
->get('consumer_secret'),
'token' => $bynder_settings
->get('token'),
'tokenSecret' => $bynder_settings
->get('token_secret'),
'baseUrl' => $bynder_settings
->get('account_domain'),
'requestOptions' => [
'timeout' => $bynder_settings
->get('timeout'),
],
];
// @TODO Re-evaluate where global and where user token is used.
$session_data = \Drupal::service('session')
->get('bynder', []);
if (!empty($session_data['access_token']) && !empty($session_data['config_hash']) && $session_data['config_hash'] == $this->state
->get('bynder_config_hash')) {
$bynder_configuration['token'] = $session_data['access_token']['oauth_token'];
$bynder_configuration['tokenSecret'] = $session_data['access_token']['oauth_token_secret'];
}
}
$this->bynderApi = BynderApiFactory::create($bynder_configuration);
return $this->bynderApi
->getAssetBankManager();
}