protected function BynderConfigurationForm::testApiConnection in Bynder 4.0.x
Same name and namespace in other branches
- 8.3 src/Form/BynderConfigurationForm.php \Drupal\bynder\Form\BynderConfigurationForm::testApiConnection()
- 8 src/Form/BynderConfigurationForm.php \Drupal\bynder\Form\BynderConfigurationForm::testApiConnection()
- 8.2 src/Form/BynderConfigurationForm.php \Drupal\bynder\Form\BynderConfigurationForm::testApiConnection()
Tests connection with the Bynder API.
Parameters
string $permanent_token: Permonent token.
string $account_domain: Account domain.
Return value
bool Whether communication was successfully established.
2 calls to BynderConfigurationForm::testApiConnection()
- BynderConfigurationForm::testConnectionAjaxCallback in src/
Form/ BynderConfigurationForm.php - AJAX callback for test connection button.
- BynderConfigurationForm::validateForm in src/
Form/ BynderConfigurationForm.php - Form validation handler.
File
- src/
Form/ BynderConfigurationForm.php, line 522
Class
- BynderConfigurationForm
- Configure bynder to enable OAuth based access.
Namespace
Drupal\bynder\FormCode
protected function testApiConnection($permanent_token, $account_domain) {
try {
$this->bynder
->setBynderConfiguration([
'permanent_token' => $permanent_token,
'baseUrl' => $account_domain,
]);
$this->bynder
->getBrands();
} catch (\Exception $exception) {
return FALSE;
}
return TRUE;
}